python安裝很簡單,沒有什麼要注意的地方。python
惟一要考慮的是,2.x版本和3.x版本。聽說是改動太大,最好只能獨立維護。不過初學者嘛,最好仍是用新版本的了。shell
2.串聯字符串,能夠用+,也能夠不用,直接寫出來就好了函數
3.字符串格式說明符%scode
"John Q. %s" % ("Public") "John %s%s" % ("Every","Man")
字符串依次被替換到%s的位置blog
>>> "%5s%s" % ("abc", "def") ' abcdef' --空格補在左邊 >>> "%-4s%s" % ("abc", "def") 'abc def' --空格補在右邊
>>> "Rock a by baby, \n\ton the tree top, \t\when the windblows\n\t\t\t the cradle will drop" 'Rock a by baby, \n\ton the tree top, \t\\when the windblows\n\t\t\t the cradle will drop' >>> print("Rock a by baby, \n\ton the tree top, \t\when the windblows\n\t\t\t the cradle will drop") Rock a by baby, on the tree top, \when the windblows the cradle will drop