python命令行获取参数
import sys
# python获取参数
input_file = sys.argv[1]
output_file = sys.argv[2]
print(input_file)
print(output_file)
输出:

本文介绍了一种在Python中从命令行读取输入文件和输出文件路径的方法,通过使用sys模块的argv属性来获取参数,并打印出来。这种方法适用于需要从命令行接收参数的脚本。
python命令行获取参数
import sys
# python获取参数
input_file = sys.argv[1]
output_file = sys.argv[2]
print(input_file)
print(output_file)
输出:

转载于:https://www.cnblogs.com/andy9468/p/10852952.html
474
347

被折叠的 条评论
为什么被折叠?