本文整理汇总了Python中File.File.convert_file_to方法的典型用法代码示例。如果您正苦于以下问题:Python File.convert_file_to方法的具体用法?Python File.convert_file_to怎么用?Python File.convert_file_to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File.File
的用法示例。
在下文中一共展示了File.convert_file_to方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from File import File [as 别名]
# 或者: from File.File import convert_file_to [as 别名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument("input", type = str, help = "input file")
parser.add_argument("ext1", type = str, help = "extension of input file")
parser.add_argument("output", type = str, help = "output file")
parser.add_argument("ext2", type = str, help = "extension of output file")
parser.add_argument("-w", dest = "white_list", help = "set file witch keys needs to convert")
parser.add_argument("-c", dest = "config_file", help = "file witch vaule needs to change")
parser.add_argument("-v", dest = "det", action = "store_true", help = "high detalisation of procces")
parser.add_argument("-vv", dest = "hdet", action = "store_true", help = "very high detalisation of procces")
args = parser.parse_args()
f = File(args.input, args.ext1)
flag = str()
if args.det == True:
flag = "-v"
elif args.hdet == True:
flag = "-vv"
f.make_dictionary(flag)
if args.white_list != None:
f.define_white_list(args.white_list, flag)
if args.config_file != None:
f.define_config_file(args.config_file, flag)
f.convert_file_to(args.output, args.ext2, flag)
if flag == "-v" or flag == "-vv":
print "All done"