更新时间:2023-01-15 19:20:12
Python。 exe script.py C:/user/text_file.txt。
我尝试过:
Python.exe script.py C:/user/text_file.txt .
What I have tried:
<pre>
import sys
def main():
infile = sys.argv[0]
Array = ["f1", "f2", "f3", "f4"]
with open(infile, "r") as input_file:
output_list = []
for rec in input_file.read().splitlines():
rec = rec[:-3]
FBlist = [rec[i:i+2] for i in range(0, len(rec), 2)]
output_list.append(FBlist)
print(output_list)
main()
我昨天解释了如何做到这一点您在 https:// www的问题.codeproject.com / Questions / 1279057 /如何读取外部路径与Python-co的文件[ ^ ]。如果这不起作用,那么使用原始问题发表评论。请不要重新打开相同的查询。
I explained how to do this yesterday in your question at https://www.codeproject.com/Questions/1279057/How-to-read-a-file-in-external-path-with-Python-co[^]. If that does not work then use the original question to post comments. Please do not reopen the same query.