Newbie question - strings

Daniel Dittmar daniel.dittmar at sap.com
Mon May 19 08:28:30 EDT 2003


mandingo wrote:
> What is the Python equivelent to VB's NthField?

The split method of strings breaks a string into fields and the index
operator allows you to pic a specific one:

>>> "Coming,,into,being, is here.".split (',')
['Coming', '', 'into', 'being', ' is here.']
>>> "Coming,,into,being, is here.".split (',') [4]
' is here.'

split without an argument breaks a string into white space delimited fields,
if you're interested in nthWord too.

Daniel








More information about the Python-list mailing list