Python-Ref > String manipulation > String splitting and joining > String joining
 
 

<-^^->
Klíčová slova
Moduly
Knihovní funkce

String joining

Introduces basic string method join.
The join method is used to concatenate sequences of strings.
Expand/Shrink
  1   words = ["First","second","third"]  # a list of strings
  2   
  3   print ' '.join( words)   # the ' ' string is used to join the list 'words'
  4   print '-'.join( words)
  5   print ' -- very long delimiter -- '.join( words)   # the joining string may be longer the 1 character
stdout:
First second third
First-second-third
First -- very long delimiter -- second -- very long delimiter -- third
Doba běhu: 13.7 ms