【问题标题】:create files, with a template and a list of name and save on files使用模板和名称列表创建文件并保存在文件中
【发布时间】:2013-12-13 09:55:12
【问题描述】:

我有一份水果清单

示例:

“香蕉”,

“苹果”,

“葡萄”,

“草莓”

我想创建文件 与文字:

“这个水果是%fruit name%,很好吃” 并保存为 %fruit name%.fruits

我是怎么做到的?可以使用任何语言

【问题讨论】:

    标签: python


    【解决方案1】:

    阅读 Python 教程——更具体地说,阅读和写入文件的部分:http://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files(但也请阅读教程的其余部分!Python 太棒了!:p)。

    应该很容易将其应用于您的问题。

    【讨论】:

      【解决方案2】:

      我不建议在批处理文件中尝试此操作。学习 Python 或 Perl 等脚本语言的基础知识更适合此类工作。

      【讨论】:

      • 如果你能帮助我,我怎么能在 python 上做到这一点
      猜你喜欢
      • 2019-03-14
      • 2016-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-11
      • 1970-01-01
      相关资源
      最近更新 更多