죄송합니다. 잘못 입력했거나 잘못 포맷하면 죄송합니다. 여기 처음입니다. 기본적으로이 스크립트는 매우 간단한 텍스트 편집기입니다. 그것은 기록,스크립트가 역순으로 쓰여집니다.
Hi, my name
is bob.
을 :하지만
is bob.
Hi, my name
가 어떻게이 문제를 해결할 수는 파일에 쓸 때 문제는 내가 그것을 쓰고 싶어, 무엇입니까? 코드는 여기에 있습니다 :
import time
import os
userdir = os.path.expanduser("~\\Desktop")
usrtxtdir = os.path.expanduser("~\\Desktop\\PythonEdit Output.txt")
def editor():
words = input("\n")
f = open(usrtxtdir,"a")
f.write(words + '\n')
nlq = input('Line saved. "/n" for new line. "/quit" to quit.\n$ ')
if(nlq == '/quit'):
print('Quitting. Your file was saved on your desktop.')
time.sleep(2)
return
elif(nlq == '/n'):
editor()
else:
print("Invalid command.\nBecause Brendan didn't expect for this to happen,\nthe program will quit in six seconds.\nSorry.")
time.sleep(6)
return
def lowlevelinput():
cmd = input("\n$ ")
if(cmd == "/edit"):
editor()
elif(cmd == "/citenote"):
print("Well, also some help from internet tutorials.\nBut Brendan did all the scripting!")
lowlevelinput()
print("Welcome to the PythonEdit Basic Text Editor!\nDeveloped completley by Brendan*!")
print("Type \"/citenote\" to read the citenote on the word Brendan.\nType \"/edit\" to begin editing.")
lowlevelinput()
그런데 상황에 대해 메모를 추가하지 않아서 유감입니다. – Brendan
어디에서 파일을 닫으시겠습니까? 쓰기 후에 닫으십시오. – Jerzyk
코드는 여기에 따라야하지만, _think_ 문제는 호출 스택을 풀 때 예상되는 출력 순서를 반대로하는 입력 함수로 재귀한다는 것입니다. 그것은 단지 추측입니다. –