On 07/13/2010 09:22 PM, Shashwat Anand wrote:
You could write:rsl = f[len(prefix):] if f.startswith(prefix) else fOr you can just do split and join, "".join(f.split(prefix, 1)) will do.
This suggestion breaks if the prefix occurs within the string rather than at the beginning:
f = "this has file:// inside it" prefix = "file://" So your suggestion really just operates like f.replace(prefix, '', 1) -tkc -- http://mail.python.org/mailman/listinfo/python-list