# arg 0: The path where the combined file will be created.
# args 1..inf: Paths to the files where your functions found.
import sys
with open(sys.argv[1], "w") as out_file:
for i in range(2, len(sys.argv)):
with open(sys.argv[i]) as in_file:
for l in in_file.readlines():
out_file.writelines(l)
out_file.writelines("\n\n")
# What ever you need to add at the end"
additional_text = 'if __name__ = "__main__":\n\tfunctiona(4)\n\tfunctionb(5)'
out_file.writelines(additional_text)
更新: 将其放入一个文件中,并从控制台使用它来组合函数并将它们输出到一个文件中。你知道吗
相关问题 更多 >
编程相关推荐