• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#coding: utf-8
3"""
4Copyright (c) 2022-2023 Huawei Device Co., Ltd.
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9    http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16
17Description: run script
18    input: input file
19    output: output file
20    prefix: prefix
21"""
22
23import argparse
24import sys
25
26
27def main():
28    parser = argparse.ArgumentParser()
29    parser.add_argument('--input', type=str, required=True)
30    parser.add_argument('--output', type=str, required=True)
31    parser.add_argument('--prefix', type=str, required=True)
32
33    args = parser.parse_args()
34
35    with open(args.input, 'r') as input_file, open(args.output, 'w') as output_file:
36        for line in input_file:
37            output_line = args.prefix + line
38            output_file.write(output_line)
39
40if __name__ == '__main__':
41    sys.exit(main())
42