[Tutor] Using split with a backslash
Steve Willoughby
steve at alchemy.com
Wed Apr 2 19:14:09 CEST 2008
On Wed, Apr 02, 2008 at 10:44:10AM -0400, Bryan Fodness wrote:
> I have a data pair separated by a backslash. I didn' t think it would see
> an end of line if the backslash was inside the quotes.
> Can this be done? I don't have a choice in what the separator is.
>
> >>> LeafJawPositions='-42.000000000001\29.800000000001'
> >>> LeafJawPositions
> '-42.000000000001\x029.800000000001'
> >>> x1, x2 = LeafJawPositions.split('\x0')
> ValueError: invalid \x escape
> >>> x1, x2 = LeafJawPositions.split('\')
Try
x1, x2 = LeafJawPositions.split('\\')
--
Steve Willoughby | Using billion-dollar satellites
steve at alchemy.com | to hunt for Tupperware.
More information about the Tutor
mailing list