我需要更改哪些內容才能使此程序起作用?我得到:可以使用提供的代碼向我解釋字符串文字嗎?
line 10
SyntaxError: Non-UTF-8 code starting with '\x92' in file C:/Users/RobotAdmin/PycharmProjects/untitled3/dialouge on line 10, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
我不知道這是什麼意思。
def main():
phrases = "Thank You Please Hello Hi How Old Are You What Is Your Address"** # String literal
print(phrases[17:22]) # This statement prints a specific segment of characters from the string literal
name = input('What is your name? :') # This statement prompts the user to enter their name and accepts it
print(phrases[23:25] + " " + name) # Retrieves from the string literal,and combines it with the name
print(phrases[25:41]) # This Statement asks for the user’s age
age = input('Age in Years? :') # This statement prompts the user to enter their age and accepts the age the entered
print(phrases[42:64]) # This segment asks What the user’s address is
address = input("Street Address, City, State, Country") #This statement asks user to enter their address
print (""
"______________________________"
"| |"
"|",name," |"
"| |"
"|",age," |"
"| |"
"|",address," |"
"| |"
"| |"
"|____________________________|")
你谷歌錯誤或訪問它告訴你要訪問的網站? – TigerhawkT3
您的輸出框的右側看起來會錯開,因爲在輸出空格以證明框時沒有考慮「name」,「age」或「address」的長度。另外,你爲什麼使用單個字符串作爲'短語'而不是一串字符串? – chepner