阅读背景:

为python脚本增加命令行参数

来源:互联网 
from argparse import ArgumentParser

p = ArgumentParser()
p.add_argument('-b', '--body', help='Return USN records in comma-separated format', action='store_true')
p.add_argument('-c', '--csv', help='Return USN records in comma-separated format', action='store_true')
p.add_argument('-f', '--file', help='Parse the given USN journal file', required=True)
p.add_argument('-o', '--outfile', help='Parse the given USN journal file', required=True)
p.add_argument('-s', '--system', help='System name (use with -t)')
p.add_argument('-t', '--tln', help='TLN ou2tput (use with -s)', action='store_true')
p.add_argument('-v', '--verbose', help='Return all USN properties for each record (JSON)', action='store_true')
args = p.parse_args()


journalSize = os.path.getsize(args.file)
with open(args.file, 'rb') as i:
    with open(args.outfile, 'wb') as o:
        i.seek(findFirstRecord(i))
        if args.csv:
            do somethingfrom argparse import ArgumentParser

p = Argume



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: