【发布时间】:2013-05-06 12:54:52
【问题描述】:
我正在尝试使用 Python 制作一个小型文本创建器应用程序。该概念与普通文本创建器(例如记事本)相同。但是我很难让用户输入很多段落。到目前为止,我只能允许用户输入 2 个段落。有没有人可以帮助我?这是我的脚本:
print "Welcome to 'Python Flat Text Creator'."
print "Please enter the name of your file and its extension (.doc atau .txt)."
filename = raw_input("> ")
target = open(filename, 'w')
typeyourtext = raw_input("Type below: \n")
target.write(typeyourtext + "\n")
typeyourtext = raw_input("\n")
target.write(typeyourtext + "\n")
target.close()
【问题讨论】:
-
所以编辑文件对你来说并不重要,不是吗?
-
现在,我想先了解如何“创建”文本:D
标签: python python-2.7