A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

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

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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())

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  7. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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')

  8. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ergh.. it double posted. sorry.

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

  10. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  11. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.