更弦的東西 << 
Previous Next >> 連接字符串
分割字符串
您可以根據給定的字符集“拆分”或拆分字符串。例如:
  teststring = "this is a test"
  result = teststring.split("t")
最後,result將包含列表:
  ['', 'his is a ', 'es', '']
除了"t",您可以編寫所需的任何字符。如果您不包含任何字符,則表示“在所有空格上分割”:
  teststring = "  this      has a lot    of   spaces and    tabs"
  result = testring.split()
然後result包含:
  ['this', 'has', 'a', 'lot', 'of', 'spaces', 'and', 'tabs']
更弦的東西 << 
Previous Next >> 連接字符串