我正在嘗試使用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()
使用循環????? – 2013-05-06 12:58:02
所以*編輯*文件對你來說並不重要,不是嗎? – Crisfole 2013-05-06 12:59:14
現在,我想知道如何首先「創建」文本:D – Khadis 2013-05-06 13:29:18