splitting using '\' as a delimiter

Peoter Veliki peoter_veliki at hotmail.com
Sun Dec 2 19:30:04 EST 2001


So the string.split and the re.split swap the order of the arguments??!!
What was the logic behind this decision?

> > I have strings like this:
> > string = 'value\key'
> > that I would like to split.  If I try splitting the string like this:
> > alias = string.split('\\',string)
> > I get:
> > alias = ['\']
>
>
> change the order of arguments:
> >>> string.split('value\\key','\\')
> ['value', 'key']
>
> or:
>
> >>> 'value\\key'.split("\\")
> ['value', 'key']
>




More information about the Python-list mailing list