How do I parse this ? regexp ?
Andrew Dalke
dalke at dalkescientific.com
Sun May 1 03:13:28 EDT 2005
serpent17 at gmail.com wrote:
> Thank you, it works, but I guess not all the way:
> but I need to remove the first - between 18:20:42 and 0.024329 but not
> the others.
Read the documentation for the string methods.
http://docs.python.org/lib/string-methods.html
replace(old, new[, count])
Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the
first count occurrences are replaced.
in your case
x = x.replace('-',' ', 1)
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list