String Formatting

alisonken1 alisonken1 at gmail.com
Thu Aug 10 16:34:05 EDT 2006


OriginalBrownster wrote:
<snip>
> Example
>
> If i had a list:    bread, butter, milk

def get_word(s, which=1, sep=','):
    return s.split(sep)[which-1].strip()

>>>
>>> get_word('bread, butter, milk')
'milk'

>>>




More information about the Python-list mailing list