Results 1 to 6 of 6

Thread: WOW Easy Python Script Not Working?

  1. #1
    Join Date
    Dec 2008
    Location
    sudo find / | grep CaseyC
    Beans
    41
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question WOW Easy Python Script Not Working?

    What is wrong here?

    Code:
    while True: 
           print("Hello, enter STOP to stop")
           varQ = str(input("Input: ")
           if var == "STOP":
                   break

  2. #2
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,461

    Re: WOW Easy Python Script Not Working?

    tip: line 3 is your problem ...

  3. #3
    Join Date
    Dec 2008
    Location
    sudo find / | grep CaseyC
    Beans
    41
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: WOW Easy Python Script Not Working?

    Sorry this is my line 3

    varQ = str(input("Input: "))


    I had to type it by hand it does contain 2 )'s at the end.

  4. #4
    Join Date
    Dec 2008
    Location
    sudo find / | grep CaseyC
    Beans
    41
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: WOW Easy Python Script Not Working?

    See attachments.
    Attached Images Attached Images

  5. #5
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,461

    Re: WOW Easy Python Script Not Working?

    Quote Originally Posted by CaseyC View Post
    Sorry this is my line 3

    varQ = str(input("Input: "))


    I had to type it by hand it does contain 2 )'s at the end.
    OK. Variable name is also correct?

    So do you realise that that line is the problem? Did you Google how to get input in Python? If Google gives you a hit on stackoverflow, use that ...

    BTW: I'm not going to write the script for you. That won't help you very much. I think it's better you find out how debug it yourself ...

  6. #6
    Join Date
    Dec 2008
    Location
    sudo find / | grep CaseyC
    Beans
    41
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: WOW Easy Python Script Not Working?

    Got it

    I used something similar to input int's into varibles but strings were handled correctly.

    Code:
    varQ = raw_input("Input: ")

    Was what I found worked however I am unsure if that is best practice. Research and learning will continue & thanks!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •