-1
私はpython2.7を使用しています。pythonでのprint()とprintの違い2.7.10
私は.py
ファイル走ったとき:
def main():
today = "Sunnday"
print ("Today is", today, ".")
main()
を私が得た:( ''、 'Sunnday' '今日は'、)
そして、私はprint
で何()
を走っていない:
def main():
today = "Sunnday"
print "Today is", today, "."
main()
今日はサンデーです。
print
とprint()
の違いは何ですか?
Python 2の 'print'は関数ではなく文です。 'print( 'foo'、 'bar')'は実際にタプル '( 'foo'、 'bar')'を出力します。 – Blender