我有三张单子
x = ["1", "2", "3"]
y = ["4", "5", "6"]
z = ["7", "8", "9"]
我需要写进一个文件,随机从x,y,z到一个新行每一次。你知道吗
Keyword = input("Directory to list")
with open(Keyword) as f:
content = f.readlines()
content = [x.strip() for x in content]
with open("test.txt") as w:
w.write(PageFormat + )
输出应如下所示:
2 // 6 // 8
3 // 4 // 9
1 // 5 // 9
2 // 5 // 9
1 // 4 // 7
(“/”包括在内)
尝试:-
样本输出:-
您可以通过更改
range()
的第二个参数来控制迭代次数。这个程序将在一个新文件中写入10行。你知道吗相关问题 更多 >
编程相关推荐