2015-07-06 15 views
1

新手在這裏。我在循環中得到了這個raw_input提示符,所以它被縮進了;將raw_input提示符編碼爲多行...?

userInput = raw_input('Enter n to deal a new hand, r to replay the last\ 
hand, or e to end game: ') 

當我運行此我得到2個選項卡的「最後」和「手」之間的空間(缺口)。有沒有辦法擺脫這種差距?

非常感謝。

+2

不會重現,我:) –

+1

@Berkhan 反斜槓號在腳本中的'last'之後或'hand'之前有一個額外的標籤。 –

+0

有一個選項卡,毫無疑問,但@falsetru的答案解決了這個問題,所以非常感謝。 – sle7en

回答

1

您可以使用string literal concatenation:使用不同的引用慣例

userInput = raw_input(
    'Enter n to deal a new hand, r to replay the last ' 
    'hand, or e to end game: ') 

多個相鄰的字符串(由空格分隔),可能 ,是允許的,以及它們的含義是 與它們串聯。因此,「你好」「世界」相當於「helloworld」 。此功能可用於減少所需的,以分裂大概長串方便跨長 線,甚至將註釋添加到字符串

的部分
+0

感謝@falsetru的明確解釋 – sle7en

相關問題