Srijayanth Sridhar wrote:
Hello,
I am wondering if it is possible to have hexadecimal strings in a ini file
and have configobj parse it correctly.
for eg:
moonw...@trantor:~/python/config$ cat foo
foo="\x96\x97"
.
.
.
a=ConfigObj("foo")
a
ConfigObj({'foo': '\\x96\\x97'})
a['foo']
'\\x96\\x97'
As you can see the string has escaped the '\' and I want to suppress that
behavior. I've looked at the documentation and haven't been able to figure
out if this is an available feature or not.
Any help will be greatly appreciated.
Thank you,
Jayanth
When you are using the Python interpreter, the interpreter will escape
the strings it displays, if you use your present approach. Try using
print() to see what the string really contains.
Both approaches are useful -- the interpreter tries to show you
approximately what you'd have to type to create that value. Print just
displays the character, allowing them to take whatever action is called
for on the output device.
>>> st = "Line 1\nLine 2"
>>> st
'Line 1\nLine 2'
>>> print st
Line 1
Line 2
>>>
--
http://mail.python.org/mailman/listinfo/python-list