[Tutor] Reading escaped characters from a file
David.Heiser at intelliden.com
Sat Oct 14 17:50:02 CEST 2006
I have code that uses variables to hold escaped characters like "\n" or
"\03". As long as the assignment is done within the code, like
self.crChar = "\n", there is no problem. But When I try to read the same
character string from a text file and assign it, the string is seen as
just a string of characters instead of an escape sequence, and the
I read the "parameter = value" pairs, like "crChar = \n", from an ASCII
file and store them in a dictionary; "parameterDict[parameter] = value".
Then I assign the value to the variable using "self.crChar =
parameterDict["crChar"]. When I print "self.crChar", it displays "\\n"
and it doesn't behave like a carriage return.
Can anyone guide me toward a resolution?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor