[Tutor] Escape sequences
David Heiser
David.Heiser at intelliden.com
Thu Jun 22 20:28:00 CEST 2006
I have code that assigns escape sequences to variables like
"self.resetString = '\03'". As long as they are hard coded in,
everything works fine.
But I want to read the variable from a text/config file so my users can
override the defaults. In the file are a list of "parameter = value"
pairs like "resetString = \03". As the file is parsed, each pair is
stored in a dictionary; "parmeterDictionary[parameter] = value".
Then in the code, the value is assigned to the variable with a statement
like "self.resetString = parmeterDictionary['resetString']".
Simple ASCII strings work fine, but the escape sequences don't work and
the code fails. "print self.resetString" returns "\\03", instead of a
nonprintable character.
Any ideas?
David Heiser
More information about the Tutor
mailing list