1. 程式人生 > >python之字符串連接

python之字符串連接

() 字符 tail gpo 一個 div tails ref 步驟

join
就屬於技巧了,利用字符串的函數 join 。這個函數接受一個列表,然後用字符串依次連接列表中每一個元素:

str_list = [‘Pyt‘, ‘hon‘]
a = ‘‘
print a.join(str_list)

步驟:

  1、建立一個列表

  2、利用 join()

原文鏈接  

python之字符串連接