📌  相关文章
📜  如何将列表写入文本文件 python - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:35.286000             🧑  作者: Mango

代码示例4
# define list of places
places = ['Berlin', 'Cape Town', 'Sydney', 'Moscow']

with open('listfile.txt', 'w') as filehandle:
    for listitem in places:
        filehandle.write('%s\n' % listitem)