關于print('hello,', 'python.')輸出結果是 ('hello,', 'python.'),而不是hello, python.
代碼:
print('hello, python.')
print'hello,', 'python.'
print('hello,', 'python.')
輸出:
hello, python.
hello, python.
('hello,', 'python.')
問題:
最后python3里面加上括號,為什么輸出不是 hello, python 而是 ('hello,', 'python.')
?
2019-10-22
是不是括號格式不對,應該是英文輸入法的括號()而不是中文輸入法的括號()。
2019-10-22
就慕課這邊的編譯器,我也不知道是2還是3,
然后我去菜鳥工具用3代翻了一遍,第二排報錯,第三排輸出是hello, python,慕課的應該就是2代版本...
但是這樣就存在一個問題了,那就是第一排輸出是單引號內的字符串,但是第三排為什么把括號全部當做字符串輸出了?
2019-10-22
?編譯器的問題吧
2019-10-22
你的Python版本是多少?我本地第一句和第三句輸出一樣,第二句報錯,我本地版本3.7的