从文本文件中提取数据并将其写入其他地方
如何读取文件并将其中的元素放入列表中并将内容写入其他文件?
文件内容
this is my house and it is very good this is my village and it is the best
good
和best
必须重复10 次。
如果可能的话帮助我
How can I read a file and put the elements in it to a list and write the contents to other file?
the file contents are
this is my house and it is very good this is my village and it is the best
good
and best
has to be repeated 10 times.
help me if possible
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你是不是有类似的意思?
Did you mean something like that?
你的问题不清楚。
您的意思是包含“好”或“最好”的行需要重复 10 次吗?
如果您的意思是实际单词需要重复 10 次:
regsub 命令的示例:
更新
根据您的评论,您可能需要:
Your question is unclear.
Do you mean the lines containing "good" or "best" need to be repeated 10 times?
If you mean the actual words need to be repeated 10 times:
An example for that regsub command:
Update
Based on your comments, you might want: