I have a python list containing \x
ASCII hex string literals as some elements and with regular strings. Is there an easy way to split this list into the two different types of strings? Example data below.
I have tried searching for the \x
substring within the string and that did not work correctly.
['\xFF', '\x42', 'A', '\xDE', '@', '\x1F']
Edit: Currently using Python 2.7.9
This is what I have tried so far
>>> list=['\xFF', '\x42', 'A', '\xDE', '@', '\x1F']
>>> print [s for s in list if '\x' in s]
ValueError: invalid \x escape
>>> print [s for s in list if '\\x' in s]
[]
>>> print [s for s in list if '\x' in s]
ValueError: invalid \x escape
>>> print [s for s in list if 'x' in s]
[]
>>>