【发布时间】:2021-11-22 07:02:06
【问题描述】:
Python String split() 方法 + 导出 ["eachpieces split"] 在不同的 .txt 和 .jpg 文件中,为每种文件类型指定路径文件夹
您好,我学习 Python,我必须对文本进行不同的操作:
- 拆分文本
- 打印拆分文本
- 将 ["each pieces split"] 包含在 print(x) 中导出到不同的 .txt 和 .jpg 文件,并为每种文件类型指定路径文件夹
步骤 1 和 2 已完成:
txt = "This is the first sentence. Then, the second
sentence. And at the end, the last sentence."
x = txt.split (".")
print(x)
['This is the first sentence', ' Then the second sentence',
' And at the end, the last sentence', '']
我想做什么:
- 将 ["each pieces split"] 包含在 print(x) 中导出到不同的 .txt 和 .jpg 文件,并为每种文件类型指定路径文件夹
有人知道我们如何制作这样的东西吗?
感谢您的帮助
【问题讨论】:
标签: python text split export txt