Title: Message
 
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 program fails.
 
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?
 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to