求大神幫忙解答一下!
求大神解答:
print("hello,python")的結果為? hello,python
print("hello,"+"python")結果為? hello,python
print('hello,','ptyhon')結果為? hello, python
那為什么print("hello,","python")結果為? ('hello,','python')
我的代碼都是在英文狀態下輸入的,求解!
求大神解答:
print("hello,python")的結果為? hello,python
print("hello,"+"python")結果為? hello,python
print('hello,','ptyhon')結果為? hello, python
那為什么print("hello,","python")結果為? ('hello,','python')
我的代碼都是在英文狀態下輸入的,求解!
2018-04-05
舉報
2018-04-05
你是指帶()嗎?我復制你的代碼在3.6的試了一下,沒有出現你寫的()
2018-04-05
"hello,python"為一個整體字符串hello,python,用" "括起來;"hello,"+"python"為兩個字符串hello,和python用運算符+連接;'hello,','ptyhon'為輸出兩個字符串hello,和python,用逗號“,”隔開,連成一串輸出,print會依次打印每個字符串,遇到逗號“,”會輸出一個空格;而print("hello,","python")被python解釋為輸出一個tuple,該tuple中包含"兩個字符串'hello,'和'python',即為?('hello,','python')