為什么這樣會報錯?
#請將下面兩行內容用Python的字符串表示并打印出來:
# Python was started in 1989 by "Guido".
#Python is free and easy to learn.
s = 'Python was started in 1989 by \"guido\".'
print s
t='Python is free and easy to learn.'
print t
#請將下面兩行內容用Python的字符串表示并打印出來:
# Python was started in 1989 by "Guido".
#Python is free and easy to learn.
s = 'Python was started in 1989 by \"guido\".'
print s
t='Python is free and easy to learn.'
print t
2015-12-15
舉報
2016-02-02
因為題目語句里面是雙引號,而右邊寫代碼的窗口給你寫好的是單引號,也就是不需要轉義符,你直接照抄就行了。
2016-01-23
s = 'Python was started in 1989 by \"Guido\".\nPython is free and easy to learn.'
print s
2015-12-16
應該是要兩句一起print出來吧,現在是分開兩次print了