1. python的string相加
That said, if you're aiming for something like Java's StringBuilder, the canonical Python idiom is to add items to a list and then use str.join
to concatenate them all at the end:
l = []
l.append('foo')
l.append('bar')
l.append('baz')
s = ''.join(l)
以下是轉(zhuǎn)自 https://github.com/qiwsir/StackOverFlowCn/blob/master/README.md
如果你是一名自詡為程序員的,那么,就必須知道stackoverflow.com這個網(wǎng)站。因?yàn)樗且粋€非常好的技術(shù)問答網(wǎng)站,里面不僅有高手,更重要的是有對問題進(jìn)行詳細(xì)耐心解答的高手。
這里我抽空翻譯了一些典型的問答,當(dāng)然,只能翻譯Python語言方面的,其它語言,唯恐因知之甚少而漏洞百出,即便是Python,也會因?yàn)椴攀鑼W(xué)淺,在翻譯過程中感到惶恐。所以,讀者如果看到錯誤之處,請不吝賜教。
歡迎訪問:www.itdiffer.com,加入學(xué)習(xí)Python的群組。
#目錄
##基本對象和語句
##文件
##函數(shù)和類
##系統(tǒng)
##網(wǎng)絡(luò)