2015-10-13 119 views
1
print ("hello world", \n, "how are you") 

我想要2個單獨的字符串顯示在不同的行,但是這不適用於mac,它在pc上的工作。是否有一個不同的命令爲Mac?在osx上的新行命令python 2.7

回答

0

您可以添加新行直接命令字符串中的及時

print ("hello world\r\nhow are you") 

,是的,命令是不同的MAC地址;它是\ r \ n

0

甚至不會爲Windows PC作爲\n工作應放在引號:

print("Hello\nworld!") 

或者print("Hello","\n","world")雖然我不明白爲什麼你分割字符串分爲三個部分。