Example:
string1 = 'It is so cold outside'
array = string1.split(' ')
Check array:
print array
['It', 'is', 'so', 'cold', 'outside']
Convert array to string:
string2 = ' '.join(array)
Check string2:
print string2
'It is so cold outside'
Just for fun:
string2 = '-'.join(array)
Check string2:
print string2
'It-is-so-cold-outside'
Thursday, October 9, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment