Split/Join

Review of some string/list/file functions/methods:

.split():

>>> s='Hi<bleep>there<bleep>Fred'
>>> things=s.split('<bleep>')
>>> print things
['Hi','there','Fred']

>>> another=s.split('<')
>>> print another
['Hi','bleep>there','bleep>Fred']

>>> t='Hi;there;Fred;'
>>> print t.split(';')
['Hi','there','Fred','']   # note the extra blank string at the end of the list

>>> v='   Hi   there Fred   '
>>> v.split()
['Hi','there','Fred']

.join():

>>> lst=['Hi','there','Fred']
>>> p=','.join(lst)
>>> print p
Hi,there,Fred

>>> print '\n'.join(lst)   # notice how print displays strings
Hi
there
Fred

>>> '\n'.join(lst)    	# notice the difference between using print to display 
			# a string, and just asking the shell to display it (as it's doing here)
'Hi\nthere\nFred'