# commalist.py # Walker M. White (wmw2) # September 7, 2013 """Module to show off how to "parse" a comma-separated list. This module only contains one function. You should study this function as you may find it helpful for Lab 2 (and therefore Assignment 1).""" def second_in_list(s): """Returns: second item in comma-separated list The final result does not have any whitespace on edges Precondition: s is a string of items separated by a comma.""" startcomma = s.index(',') tail = s[startcomma+1:] # print tail endcomma = tail.index(',') item = tail[:endcomma].strip() # item = tail[:endcomma] return item