Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 37 Online
OpenStudy (anonymous):

I am having a problem with problem set 10.when i run the wx gui and type a value in the inbox and examine it in the debugging window it shows up with u in front of the string that i entered and so is not recognized as a valid word.any on know how to fix this.running on win 7 machine.thanks

OpenStudy (anonymous):

where (what module, class, function) are you printing from? Sounds like an interesting problem.

OpenStudy (anonymous):

it is in the ps10_gui.py file in the playframe class and the OnEnter function where it gets the value entered in the inputbox.

OpenStudy (anonymous):

So you've got something like print self.inputBox.GetValue() ?

OpenStudy (anonymous):

I just looked through my solution and inserted a print statement where I think you have one. I had a window pop up with my word in it, but there was no u in front of it. my print command is in the OnEnter function: def OnEnter(self, event): """ Handle the event where the submit button was pressed. """ if self.submitButton.IsEnabled(): print self.inputBox.GetValue() self.TryWord(self.inputBox.GetValue())

OpenStudy (anonymous):

having trouble getting posts to go through.I tried the print statement and it shows the same as my input.i have no experience with wx python and was unaware that the print statement would work.thanks for your input I may be looking in the wrong place for my invalid reponse.

OpenStudy (anonymous):

If you're seeing an added u on a variable, a good place to start looking is the function that contains the print statement that printed the variable.

OpenStudy (anonymous):

If I were to guess, I'd say that the u is showing up as a result of the return value being a unicode object rather than a typical string. Make sure that you're printing the returned value rather than just having it show up in your interactive session as the result of an expression. In the print case it'll be converted to a string. In the other case you'll get the repr() version of the value which will have the u prefix (e.g. blah instead of u'blah')

OpenStudy (anonymous):

ergh.. it double posted. sorry.

OpenStudy (anonymous):

OpenStudy (anonymous):

thanks for your input,after the previous response i assumed it also may have something to do with being unicode and was able to find my coding error.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Breathless: womp
6 minutes ago 0 Replies 0 Medals
Breathless: yo who wanna match pfp?
8 minutes ago 11 Replies 1 Medal
Ylynnaa: This was long time ago lmk if u fw itud83dude1d
3 hours ago 17 Replies 2 Medals
abound: Wow question cove really fell off
5 hours ago 6 Replies 1 Medal
ayden09: chat i love black pink hehe i like jones to
5 hours ago 20 Replies 2 Medals
kamani7676: help
1 day ago 5 Replies 1 Medal
kamani7676: Help
1 day ago 76 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!