Re: raw_input and break

2015-11-06 Thread input/ldompeling
for (dir, tm) in SEQUENCE: > NameError: name 'SEQUENCE' is not defined > --- > > import time > import threading > > set_right_speed(150) > set_left_speed(105) > > def cmdHandler(): > g

Re: raw_input and break

2015-11-05 Thread input/ldompeling
for (dir, tm) in SEQUENCE: NameError: name 'SEQUENCE' is not defined --- import time import threading set_right_speed(150) set_left_speed(105) def cmdHandler(): global notDone while True:

Re: raw_input and break

2015-11-05 Thread input/ldompeling
Oke, lets try your code.Can you help me with that. This is my code: - from gopigo import * import time set_right_speed(150) set_left_speed(105) enable_servo() fwd() print("forward 1x") time.sleep(4) stop() while True: servo(90) mindist = 80

Re: raw_input and break

2015-11-05 Thread Peter Otten
input/ldompel...@casema.nl wrote: >>The code in capture_key.py may look a bit scary, but just as I took it >>without bothering the details you can take the resulting module without >>caring about the code in it. Alternatively you can search > >>https://pypi.python.org > > Thanks for the link. I

Re: raw_input and break

2015-11-05 Thread input/ldompeling
> > > > > input/ldompel...@casema.nl wrote: > > > > > > > > choices = raw_input("letter s to stop:") > > > > > > > > Oh no, this is not what I want. Now it is waiting for input when its go > > > > further with the script. Because I

Re: raw_input and break

2015-11-05 Thread Peter Otten
input/ldompel...@casema.nl wrote: > In reply to "Peter Otten" who wrote the following: > >> input/ldompel...@casema.nl wrote: >> >> > > choices = raw_input("letter s to stop:") >> > >> > Oh no, this is not what I want.

Re: raw_input and break

2015-11-05 Thread input/ldompeling
In reply to "Peter Otten" who wrote the following: > input/ldompel...@casema.nl wrote: > > > > choices = raw_input("letter s to stop:") > > > > Oh no, this is not what I want. Now it is waiting for input when its go > > further with the scr

Re: raw_input and break

2015-11-05 Thread Peter Otten
input/ldompel...@casema.nl wrote: > > choices = raw_input("letter s to stop:") > > Oh no, this is not what I want. Now it is waiting for input when its go > further with the script. Because I have an while True: so I want that the > script go's continue onl

Re: raw_input and break

2015-11-05 Thread input/ldompeling
assumes Python 3. >To fix your problem replace the line > choices = input("letter s to stop:") >in your script with > choices = raw_input("letter s to stop:") Oh no, this is not what I want. Now it is waiting for input when its go further

Re: raw_input and break

2015-11-05 Thread Peter Otten
r script. In this particular case the problem is that you are using Python 2 where input() tries to execute the text the user enters as Python code. Tian's example code assumes Python 3. To fix your problem replace the line choices = input("letter s to stop:") in your script with choices = raw_input("letter s to stop:") -- https://mail.python.org/mailman/listinfo/python-list

Re: raw_input and break

2015-11-05 Thread input/ldompeling
while True:" > > Now I want to use "raw_input" and when I press "s" on the keybord that it= > will=20 > > "break" the continues loop. In this script it always break even when I not press 's' I want th

Re: raw_input and break

2015-11-04 Thread tian . su . yale
在 2015年11月4日星期三 UTC-6下午3:45:09,input/ld...@casema.nl写道: > I have an continues loop with "while True:" > Now I want to use "raw_input" and when I press "s" on the keybord that it > will > "break" the continues loop. > > I tried: > choi

Re: raw_input and break

2015-11-04 Thread Steven D'Aprano
On Thu, 5 Nov 2015 09:37 am, input/ldompel...@casema.nl wrote: > I quote the s, but its still break even when I not press the s. The code you have shown us is so full of bugs and typos that you cannot possibly be running that code. Unfortunately, we do not have magical powers. We cannot see the

Re: raw_input and break

2015-11-04 Thread input/ldompeling
In reply to "Joel Goldstick" who wrote the following: > On Wed, Nov 4, 2015 at 4:44 PM, wrote: > > > I have an continues loop with "while True:" > > Now I want to use "raw_input" and when I press "s" on the keybord that it > > wi

Re: raw_input and break

2015-11-04 Thread Joel Goldstick
On Wed, Nov 4, 2015 at 4:44 PM, wrote: > I have an continues loop with "while True:" > Now I want to use "raw_input" and when I press "s" on the keybord that it > will > "break" the continues loop. > > I tried: > choices = raw_input &g

Re: raw_input and break

2015-11-04 Thread Ian Kelly
On Wed, Nov 4, 2015 at 2:44 PM, wrote: > I have an continues loop with "while True:" > Now I want to use "raw_input" and when I press "s" on the keybord that it will > "break" the continues loop. > > I tried: > choices = raw_inpu

raw_input and break

2015-11-04 Thread input/ldompeling
I have an continues loop with "while True:" Now I want to use "raw_input" and when I press "s" on the keybord that it will "break" the continues loop. I tried: choices = raw_input if choises == s: break But even when I not press "s" it "

Re: Testing interactive code using raw_input

2014-03-11 Thread Steven D'Aprano
On Mon, 10 Mar 2014 17:57:19 +0100, Peter Otten wrote: > Steven D'Aprano wrote: >> what are my options for *automatically* supplying input to raw_input? > > https://pypi.python.org/pypi/mock > > In Python 3 this is part of the standard library: Nice! Thanks

Re: Testing interactive code using raw_input

2014-03-10 Thread Ben Finney
Steven D'Aprano writes: > Does anyone have any good hints for testing interactive code that uses > raw_input, or input in Python 3? Are you testing the behaviour of the ‘input’ function? If not, then it is an external dependency; and, since you're not interested in testing it

Re: Testing interactive code using raw_input

2014-03-10 Thread Ethan Furman
On 03/10/2014 08:59 AM, Steven D'Aprano wrote: With an automated test, I can provide the arguments, and check the result, but what are my options for *automatically* supplying input to raw_input? pexpect? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Testing interactive code using raw_input

2014-03-10 Thread Peter Otten
Steven D'Aprano wrote: > Does anyone have any good hints for testing interactive code that uses > raw_input, or input in Python 3? > > A simple technique would be to factor out the interactive part, e.g. like > this: > > # Before > def spam(): > answer = raw

Re:Testing interactive code using raw_input

2014-03-10 Thread Dave Angel
Steven D'Aprano Wrote in message: > Does anyone have any good hints for testing interactive code that uses > raw_input, or input in Python 3? > > A simple technique would be to factor out the interactive part, e.g. like > this: > > # Before > def spam(): &g

Re: Testing interactive code using raw_input

2014-03-10 Thread Oscar Benjamin
On 10 March 2014 15:59, Steven D'Aprano wrote: > Does anyone have any good hints for testing interactive code that uses > raw_input, or input in Python 3? > > A simple technique would be to factor out the interactive part, e.g. like > this: > > # Before > def spa

Testing interactive code using raw_input

2014-03-10 Thread Steven D'Aprano
Does anyone have any good hints for testing interactive code that uses raw_input, or input in Python 3? A simple technique would be to factor out the interactive part, e.g. like this: # Before def spam(): answer = raw_input(prompt) return eggs(answer) + cheese(answer) + toast(answer

Re: question about input() and/or raw_input()

2014-01-19 Thread Larry Martell
On Sun, Jan 19, 2014 at 1:12 PM, Gene Heskett wrote: > On Sunday 19 January 2014 15:11:52 Larry Martell did opine: > >> On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence > wrote: >> > On 19/01/2014 18:15, Grant Edwards wrote: >> >> On 2014-01-19, Mark Lawrence wrote: >> >>> Actually, to go off at

Re: question about input() and/or raw_input()

2014-01-19 Thread Gene Heskett
On Sunday 19 January 2014 15:08:31 Roy Smith did opine: > In article , > > Grant Edwards wrote: > > I can still remember the point in my first trip to the UK when I > > accidentally stumbled across darts on TV. Given the endless variety > > (and quantity) of pointless crap that people watch her

Re: question about input() and/or raw_input()

2014-01-19 Thread Gene Heskett
On Sunday 19 January 2014 15:11:52 Larry Martell did opine: > On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence wrote: > > On 19/01/2014 18:15, Grant Edwards wrote: > >> On 2014-01-19, Mark Lawrence wrote: > >>> Actually, to go off at a tangent, I'm just getting into GUIs via > >>> wxPython. I'v

Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman
On 01/19/2014 10:41 AM, Chris Angelico wrote: On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman wrote: The difference I was thinking of is: "%h" % 3.14 # this works vs. hex(3.14) # this raises In 3.5 both will raise. Now you have me *thoroughly* intrigued. It's not %h (incomplete form

Re: question about input() and/or raw_input()

2014-01-19 Thread Mark Lawrence
On 19/01/2014 19:24, Larry Martell wrote: On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence wrote: On 19/01/2014 18:15, Grant Edwards wrote: On 2014-01-19, Mark Lawrence wrote: Actually, to go off at a tangent, I'm just getting into GUIs via wxPython. I've discovered there are distinct advan

Re: question about input() and/or raw_input()

2014-01-19 Thread Larry Martell
On Sun, Jan 19, 2014 at 12:17 PM, Mark Lawrence wrote: > On 19/01/2014 18:15, Grant Edwards wrote: >> >> On 2014-01-19, Mark Lawrence wrote: >>> Actually, to go off at a tangent, I'm just getting into GUIs via >>> wxPython. I've discovered there are distinct advantages having to >>> write endles

Re: question about input() and/or raw_input()

2014-01-19 Thread Mark Lawrence
On 19/01/2014 18:15, Grant Edwards wrote: On 2014-01-19, Mark Lawrence wrote: On 18/01/2014 18:41, Mark Lawrence wrote: On 18/01/2014 18:30, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other

Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-19, Roy Smith wrote: > In article , > Grant Edwards wrote: > >> I can still remember the point in my first trip to the UK when I >> accidentally stumbled across darts on TV. Given the endless variety >> (and quantity) of pointless crap that people watch here in the US, I >> can't real

Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 5:37 AM, Roy Smith wrote: > What's so complicated? > > points = 501 > for dart in throws(): >if points - dart == 0 and dart.is_double(): > raise YouWin >if points - dart < 0: > continue >points -= dart >beer.drink() assert victory raise beer Ch

Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman wrote: > The difference I was thinking of is: > > "%h" % 3.14 # this works > > vs. > > hex(3.14) # this raises > > In 3.5 both will raise. Now you have me *thoroughly* intrigued. It's not %h (incomplete format - h is a modifier), nor %H (unsuppo

Re: question about input() and/or raw_input()

2014-01-19 Thread Roy Smith
In article , Grant Edwards wrote: > I can still remember the point in my first trip to the UK when I > accidentally stumbled across darts on TV. Given the endless variety > (and quantity) of pointless crap that people watch here in the US, I > can't really explain why I was so baffled and amused

Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman
On 01/19/2014 08:38 AM, Chris Angelico wrote: On Mon, Jan 20, 2014 at 3:14 AM, Ethan Furman wrote: --> def quux1(x): return str(x+1) --> quux1(2.3) '3.3' (Will be) fixed in 3.5 [1] :) [1] Which is to say, both will raise an exception. Why would that raise? Sorry, should have read that c

Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-19, Mark Lawrence wrote: > On 18/01/2014 18:41, Mark Lawrence wrote: >> On 18/01/2014 18:30, Roy Smith wrote: >>> Pardon me for being cynical, but in the entire history of the universe, >>> has anybody ever used input()/raw_input() for anything other

Re: question about input() and/or raw_input()

2014-01-19 Thread Mark Lawrence
On 18/01/2014 18:41, Mark Lawrence wrote: On 18/01/2014 18:30, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other than a homework problem? Not me personally. I guess raw_input must have been

Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 4:42 AM, Grant Edwards wrote: > 2) I didn't claim that sys.stdin.readline() was as simple as using >input. I didn't claim it was preferable. I merely presented it as >a refutation to the argument that if you don't use input/raw_input >

Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
re history of the universe, >>>> has anybody ever used input()/raw_input() for anything other than a >>>> homework problem? >>> >>> Homework problems (and 'toy' programs, such as hangman), whether in a >>> programming class or elsewhere, are o

Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Mon, Jan 20, 2014 at 3:14 AM, Ethan Furman wrote: >>> --> def quux1(x): return str(x+1) >> --> quux1(2.3) >> '3.3' > > (Will be) fixed in 3.5 [1] :) > [1] Which is to say, both will raise an exception. Why would that raise? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: question about input() and/or raw_input()

2014-01-19 Thread Ethan Furman
On 01/19/2014 12:26 AM, Rustom Mody wrote: On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote: On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote: As do these pieces of code: --> def quux1(x): return str(x+1) --> def quux2(x): return hex(x+1)[2:] They do? --> quux1(2.3

Re: question about input() and/or raw_input()

2014-01-19 Thread Grant Edwards
On 2014-01-18, Terry Reedy wrote: > On 1/18/2014 1:30 PM, Roy Smith wrote: >> Pardon me for being cynical, but in the entire history of the universe, >> has anybody ever used input()/raw_input() for anything other than a >> homework problem? > > Homework problems (

Re: question about input() and/or raw_input()

2014-01-19 Thread Chris Angelico
On Sun, Jan 19, 2014 at 7:26 PM, Rustom Mody wrote: > If you want to give an irrelevant example at least give a correct one :D > the difference between str and hex is an arcane difference (Ive never used > hex) > the difference between functions and procedures is absolutely basic. They don't giv

Re: question about input() and/or raw_input()

2014-01-19 Thread Rustom Mody
On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote: > On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote: > > Because these two pieces of code > def foo(x): print x+1 > def bar(x): return x+1 > > look identical (to a beginner at least) > foo(3) > > 4 > bar(3)

Re: question about input() and/or raw_input()

2014-01-18 Thread Steven D'Aprano
On Sat, 18 Jan 2014 13:30:20 -0500, Roy Smith wrote: > Pardon me for being cynical, but in the entire history of the universe, > has anybody ever used input()/raw_input() for anything other than a > homework problem? Yes. They are excellent for interactive command line tools. -

Re: question about input() and/or raw_input()

2014-01-18 Thread Chris Angelico
On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote: > Because these two pieces of code > def foo(x): print x+1 > def bar(x): return x+1 > > look identical (to a beginner at least) > foo(3) > 4 bar(3) > 4 As do these pieces of code: >>> def quux(x): return str(x+1) >>> de

Re: question about input() and/or raw_input()

2014-01-18 Thread Rustom Mody
; >> has anybody ever used input()/raw_input() for anything other than a > >> homework problem? > > Similar 'cynicism' regarding print would be salutary for producing better > > programmers > > [If youve taught programming and had to deal with code str

Re: question about input() and/or raw_input()

2014-01-18 Thread Chris Angelico
On Sun, Jan 19, 2014 at 3:15 PM, Rustom Mody wrote: > On Sunday, January 19, 2014 12:00:20 AM UTC+5:30, Roy Smith wrote: >> Pardon me for being cynical, but in the entire history of the universe, >> has anybody ever used input()/raw_input() for anything other than a >

Re: question about input() and/or raw_input()

2014-01-18 Thread Rustom Mody
On Sunday, January 19, 2014 12:00:20 AM UTC+5:30, Roy Smith wrote: > Pardon me for being cynical, but in the entire history of the universe, > has anybody ever used input()/raw_input() for anything other than a > homework problem? Similar 'cynicism' regarding print wo

Re: question about input() and/or raw_input()

2014-01-18 Thread Chris Angelico
On Sun, Jan 19, 2014 at 8:33 AM, Terry Reedy wrote: > On 1/18/2014 1:30 PM, Roy Smith wrote: >> >> Pardon me for being cynical, but in the entire history of the universe, >> has anybody ever used input()/raw_input() for anything other than a >> homework problem? > &

Re: question about input() and/or raw_input()

2014-01-18 Thread Terry Reedy
On 1/18/2014 1:30 PM, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other than a homework problem? Homework problems (and 'toy' programs, such as hangman), whether in a programmin

Re: question about input() and/or raw_input()

2014-01-18 Thread Peter Otten
Roy Smith wrote: > Pardon me for being cynical, but in the entire history of the universe, > has anybody ever used input()/raw_input() for anything other than a > homework problem? I use it for pointless throwaway tools, sometimes via the cmd module, sometimes directly. I like tha

Re: question about input() and/or raw_input()

2014-01-18 Thread Emile van Sebille
On 01/18/2014 10:30 AM, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other than a homework problem? Yes - routinely. Emile -- https://mail.python.org/mailman/listinfo/python-list

Re: question about input() and/or raw_input()

2014-01-18 Thread Mark Lawrence
On 18/01/2014 18:30, Roy Smith wrote: Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other than a homework problem? Not me personally. I guess raw_input must have been used somewhere at some time for something

question about input() and/or raw_input()

2014-01-18 Thread Roy Smith
Pardon me for being cynical, but in the entire history of the universe, has anybody ever used input()/raw_input() for anything other than a homework problem? -- https://mail.python.org/mailman/listinfo/python-list

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread random832
search): > 1. Creates ssh port forward via the subprocess module > (http://unix.stackexchange.com/questions/4740/screen-remote-login-failure-an > d-disappearing-text) > 2. Using the getpass module (raw_input?) > Calling "$ reset" brings back the disappearing text, so I&#x

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread David M. Welch
e.com/questions/4740/screen-remote-login-failure-an d-disappearing-text) 2. Using the getpass module (raw_input?) Calling "$ reset" brings back the disappearing text, so I'm just wondering if this issue has been addressed and if so, what should I be doing that I'm not. Thank you,

Re: Newbie question about evaluating raw_input() responses

2013-05-25 Thread Fábio Santos
On 25 May 2013 19:37, "Chris Angelico" wrote: > Ah, who am I kidding. Be as rude as you like. I have to work with PHP all week. > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list I have cried. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about evaluating raw_input() responses

2013-05-25 Thread Chris Angelico
On Sun, May 26, 2013 at 4:27 AM, Nobody wrote: > On Thu, 23 May 2013 17:20:19 +1000, Chris Angelico wrote: > >> Aside: Why was PHP's /e regexp option ever implemented? > > Because it's a stupid idea, and that's the only requirement for a feature > to be implemented in PHP. Hey, don't be rude. I m

Re: Newbie question about evaluating raw_input() responses

2013-05-25 Thread Nobody
On Thu, 23 May 2013 17:20:19 +1000, Chris Angelico wrote: > Aside: Why was PHP's /e regexp option ever implemented? Because it's a stupid idea, and that's the only requirement for a feature to be implemented in PHP. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about evaluating raw_input() responses

2013-05-23 Thread Chris Angelico
On Thu, May 23, 2013 at 5:11 PM, Terry Jan Reedy wrote: > On 5/23/2013 12:47 AM, Steven D'Aprano wrote: >> >> On Wed, 22 May 2013 22:31:04 +, Alister wrote: >> >>> Please write out 1000 time (without using any form of loop) >>> >>> "NEVER use input in python <3.0 it is EVIL"* > > >> But all jo

Re: Newbie question about evaluating raw_input() responses

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 12:47 AM, Steven D'Aprano wrote: On Wed, 22 May 2013 22:31:04 +, Alister wrote: Please write out 1000 time (without using any form of loop) "NEVER use input in python <3.0 it is EVIL"* But all joking aside, eval is dangerous, yes, but it is not "evil". He put that label o

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Chris Angelico
:-) No need to be irrational about eval(), but I do agree that input() should never be used. Especially now that Py3 has changed the meaning of input(), it's potentially very confusing to call the old function; be explicit and use eval(raw_input()) if you actually want that. Quite apart fro

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Steven D'Aprano
On Wed, 22 May 2013 22:31:04 +, Alister wrote: > Please write out 1000 time (without using any form of loop) > > "NEVER use input in python <3.0 it is EVIL"* > > as Chris A point out it executes user input an can cause major damage > (reformatting the hard disk is not impossible!) Is he all

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Kevin Xi
Oh yes, you guys are right. Thank you very much for warning me that. On Thursday, May 23, 2013 6:31:04 AM UTC+8, Alister wrote: > > as Chris A point out it executes user input an can cause major damage > > (reformatting the hard disk is not impossible!) > It definitely can cause major damage

RE: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Carlos Nepomuceno
ause major damage > (reformatting the hard disk is not impossible!) > Indeed! input is eval(raw_input())! lol -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Alister
;> >> Can anyone point me to what I am doing wrong? Many thanks in advance. >> >> >> >> age=raw_input('Enter your age: ') >> >> if age > 18: >> >> print ('Wow, %s. You can buy cigarettes.' % age) >> >&

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 4:52 PM, Kevin Xi wrote: > On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote: >> age=raw_input('Enter your age: ') >> if age > 18: > > You can either use `raw_input` to read data and convert it to right type, or > u

Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread C. N. Desrosiers
quot; -- even if I enter a value below 18. > > > > Can anyone point me to what I am doing wrong?  Many thanks in advance. > > > > age=raw_input('Enter your age: ') > > if age > 18: > >     print ('Wow, %s. You can buy cigarettes.&#

Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread Kevin Xi
http://docs.python.org > > When I run the below code, it always ends up printing response to "if age > > 18:" -- even if I enter a value below 18. > > > > Can anyone point me to what I am doing wrong? Many thanks in advance. > > > > age=raw_inpu

Re: Newbie question about evaluating raw_input() responses

2013-05-21 Thread Fábio Santos
> script that can have a simple conversation with the user. > > When I run the below code, it always ends up printing response to "if age > > 18:" -- even if I enter a value below 18. > > Can anyone point me to what I am doing wrong? Many thanks in advance. > > age=r

Newbie question about evaluating raw_input() responses

2013-05-21 Thread C. N. Desrosiers
to what I am doing wrong? Many thanks in advance. age=raw_input('Enter your age: ') if age > 18: print ('Wow, %s. You can buy cigarettes.' % age) else: print ('You are a young grasshopper.') -- http://mail.python.org/mailman/listinfo/python-list

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Dave Angel
nd: f Command: a Michael Palin Invalid Command: a Michael Palin Command: a John Cleese, Cheese Shop, 5552233, 5 May John Cleese is already a friend Command: a Michael Palin, Cheese Shop, 5552233, 5 May Command: f Michael Palin Michael Palin: Cheese Shop, 5552233, 5 May Command: e Saving changes...

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Frank
Now you've saved the data in a different file. How does the next run of the program find it? What user? In what environment can a user enter function calls into your code? -The user will call the function out from IDLE Why is the command invalid? -Because the user need to type out a name

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Dave Angel
not know how do i apply it into interact() my rough idea is : def interact(*arg): open('friends.csv', 'rU') d = load_friends('friends.csv') print "Friends File: friends.csv" s = raw_input() command = s.split(" ", 1) if &q

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Frank
t I do not know how do i apply it into interact() my rough idea is : def interact(*arg): open('friends.csv', 'rU') d = load_friends('friends.csv') print "Friends File: friends.csv" s = raw_input() command = s.split(" ", 1)

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Dave Angel
May Command: e Saving changes... Exiting... my code so far for interact: #interact function def interact(*arg): open('friends.csv', 'rU') d = load_friends('friends.csv') print "Friends File: friends.csv" s = raw_input("Please inpu

raw_input that able to do detect multiple input

2013-04-06 Thread Frank
... Exiting... my code so far for interact: #interact function def interact(*arg): open('friends.csv', 'rU') d = load_friends('friends.csv') print "Friends File: friends.csv" s = raw_input("Please input something: ") command = s.split(&quo

Re: input() or raw_input() in Console module.

2011-05-09 Thread alex23
On May 9, 10:13 pm, ander2_1...@hotmail.com wrote: > I'm using Console module (doc:http://effbot.org/zone/console-handbook.htm, > like nCurses) on Windows, but I don't know how to call a keyboard > input like input() or raw_input(). > What to do? Maybe read the docs, sp

input() or raw_input() in Console module.

2011-05-09 Thread ander2_1434
I'm using Console module (doc: http://effbot.org/zone/console-handbook.htm, like nCurses) on Windows, but I don't know how to call a keyboard input like input() or raw_input(). What to do? -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob raw_input question

2010-02-24 Thread Abigail
Thank You -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob raw_input question

2010-02-24 Thread Steve Holden
Abigail wrote: > Yesterday I downloaded and installed Python 3.1 and working through some > examples but I have hit a problem > >>>> a = raw_input("Enter a number" ) > Traceback (most recent call last): > File "", line 1, in > a = raw_inp

Re: Noob raw_input question

2010-02-24 Thread John Posner
On 2/24/2010 12:39 PM, Abigail wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input("Enter a number" ) Traceback (most recent call last): File "", line 1, in a = raw_input("Enter a

Re: Noob raw_input question

2010-02-24 Thread Robert Kern
On 2010-02-24 11:39 AM, Abigail wrote: Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem a = raw_input("Enter a number" ) Traceback (most recent call last): File "", line 1, in a = raw_input("Enter a

Re: Noob raw_input question

2010-02-24 Thread Chris Rebert
On Wed, Feb 24, 2010 at 9:39 AM, Abigail wrote: > Yesterday I downloaded and installed Python 3.1 and working through some > examples but I have hit a problem > >>>> a = raw_input("Enter a number" ) > Traceback (most recent call last): >  File "",

Noob raw_input question

2010-02-24 Thread Abigail
Yesterday I downloaded and installed Python 3.1 and working through some examples but I have hit a problem >>> a = raw_input("Enter a number" ) Traceback (most recent call last): File "", line 1, in a = raw_input("Enter a number" ) NameErr

Re: Printing with raw_input

2010-02-16 Thread Peter Otten
Shashwat Anand wrote: > raw_input uses sys.stderr I guess ? I had a look at the C code, but it's a bit confusing. If I'm reading it correctly the prompt is written to the "real" stderr if and only if sys.stdin and sys.stdout are attached to a terminal. $ python -c&q

Re: Printing with raw_input

2010-02-15 Thread Shashwat Anand
raw_input uses sys.stderr I guess ? On Mon, Feb 15, 2010 at 5:35 PM, Peter Otten <__pete...@web.de> wrote: > Joan Miller wrote: > > >> > Does `raw_input` uses internally `sys.stdout.write`? > > > It was to display the output inside a GUI app. overriding > >

Re: Printing with raw_input

2010-02-15 Thread Peter Otten
Joan Miller wrote: >> > Does `raw_input` uses internally `sys.stdout.write`? > It was to display the output inside a GUI app. overriding > `sys.stdout`. And as `print` also uses internally `sys.stdout.write` > then can be used `print` the shell script and get the output too in

Re: Printing with raw_input

2010-02-15 Thread Joan Miller
On 15 feb, 10:11, Peter Otten <__pete...@web.de> wrote: > Joan Miller wrote: > > Does `raw_input` uses internally `sys.stdout.write`? > > You can test this yourself without reading the C source: > > Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) > [GCC 4.4.1] on li

Re: Printing with raw_input

2010-02-15 Thread Peter Otten
Joan Miller wrote: > Does `raw_input` uses internally `sys.stdout.write`? You can test this yourself without reading the C source: Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license

Printing with raw_input

2010-02-15 Thread Joan Miller
Does `raw_input` uses internally `sys.stdout.write`? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to timeout when waiting for raw_input from user ?

2009-12-07 Thread Rune Strand
On Dec 5, 3:42 pm, Maxim Khitrov wrote: > I'm not talking about the Timer, I'm talking about the original > question. There's nothing (that I know of) you can do with a Timer on > Windows to interrupt a raw_input call. That is true. But if the issue here is to prese

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread zeph
Here's what I came up with, though it only asks once question then quits depending on the answer or lack thereof. And while, yes, you can't interrupt a raw_input call from a timer, providing for a blank line (user hitting enter) is a way around it: import threading import Timer f

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread MrJean1
Try using the function timelimited from this recipe <http://code.activestate.com/recipes/576780/> An (untested) example with a 60 second timeout would be: try: r = timelimited(60, raw_input, 'enter right or wrong: ') except TimeLimitExpired: except K

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Maxim Khitrov
def hello(): >    print "hello, world" > > t = Timer(30.0, hello) > t.start() # after 30 seconds, "hello, world" will be printed I'm not talking about the Timer, I'm talking about the original question. There's nothing (that I know of) you can do with a

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Rune Strand
On Dec 5, 3:07 pm, Maxim Khitrov wrote: > > Doesn't work on Windows. > > - Max Yes, it does. I've used it a lot, also in Py2Exe apps. Try the documentation example yourself def hello(): print "hello, world" t = Timer(30.0, hello) t.start() # after 30 seconds, "hello, world" will be printed

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Maxim Khitrov
On Sat, Dec 5, 2009 at 9:01 AM, Rune Strand wrote: > The easiest wasy is to use the Timer object in the threading module. > > > from threading import Timer Doesn't work on Windows. - Max -- http://mail.python.org/mailman/listinfo/python-list

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Rune Strand
The easiest wasy is to use the Timer object in the threading module. from threading import Timer -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   >