2015-09-27 73 views

回答

1

這是不優雅,但你可以帶線的結局,然後更換空間和標籤:

askuser = askuser.strip().replace(' ','').replace('\t','') 
0

嘗試使用表示通過以下方式所有空白正則表達式的字符集:

new_input = re.sub(r'\s+', '', input('Enter A Sentence: ')) # whitespace is now empty str 
+0

謝謝你現在得到它 –

+0

@Ezan​​aTesfaye請用標記旁邊的標記作爲答案。 –

相關問題