【发布时间】:2020-04-20 11:01:05
【问题描述】:
我有一个列表如下:
list_of_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
我想用以下格式写到file.txt。
1 2 3
4 5 6
7 8 9
10 11 12
请注意,file.txt 中没有 逗号 和 方括号。
我试图将list_of_list 变平并写信给file.txt,但我得到了以下输出:
1
2
3
etc.
【问题讨论】:
-
这能回答你的问题吗? python how to write list of lists to file
标签: python python-3.x list arraylist