Re: Loop Question

2013-06-25 Thread Dave Angel
On 06/24/2013 08:20 AM, Lutz Horn wrote: Hi, Am 24.06.2013 14:12 schrieb christheco...@gmail.com: username=raw_input("Please enter your username: ") password=raw_input("Please enter your password: ") if username == "john doe" and password == "fopwpo": print "Login Successful" else: pr

Re: Loop Question

2013-06-25 Thread Lutz Horn
Hi, Am 24.06.2013 14:12 schrieb christheco...@gmail.com: username=raw_input("Please enter your username: ") password=raw_input("Please enter your password: ") if username == "john doe" and password == "fopwpo": print "Login Successful" else: print "Please try again" while not usernam

Re: Loop Question

2013-06-24 Thread Dave Angel
On 06/24/2013 03:00 PM, John Gordon wrote: In =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= writes: while True: username = raw_input("Please enter your username: ") password = raw_input("Please enter your password: ") if username == "john doe" and password == "fopwpo":

Re: Loop Question

2013-06-24 Thread John Gordon
In =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= writes: > > while True: > > username = raw_input("Please enter your username: ") > > password = raw_input("Please enter your password: ") > > > > if username == "john doe" and password == "fopwpo": > > print "Login Suc

Re: Loop Question

2013-06-24 Thread Chris “Kwpolska” Warrick
On Mon, Jun 24, 2013 at 8:42 PM, John Gordon wrote: > In > christheco...@gmail.com writes: > >> On Sunday, June 23, 2013 6:18:35 PM UTC-5, christ...@gmail.com wrote: >> > How do I bring users back to beginning of user/password question once they >> > >> > fail it? thx > >> Can't seem to get this

Re: Loop Question

2013-06-24 Thread John Gordon
In christheco...@gmail.com writes: > On Sunday, June 23, 2013 6:18:35 PM UTC-5, christ...@gmail.com wrote: > > How do I bring users back to beginning of user/password question once they > > > > fail it? thx > Can't seem to get this to cooperate...where does the while statement belong? while T

Re: Loop Question

2013-06-24 Thread christhecomic
On Sunday, June 23, 2013 6:18:35 PM UTC-5, christ...@gmail.com wrote: > How do I bring users back to beginning of user/password question once they > > fail it? thx Can't seem to get this to cooperate...where does the while statement belong? -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop Question

2013-06-24 Thread rusi
On Monday, June 24, 2013 5:42:51 PM UTC+5:30, christ...@gmail.com wrote: > Here is my code...I'm using 2.7.5 > > > username=raw_input("Please enter your username: ") > password=raw_input("Please enter your password: ") > if username == "john doe" and password == "fopwpo": > print "Login Succ

Re: Loop Question

2013-06-24 Thread christhecomic
Here is my code...I'm using 2.7.5 username=raw_input("Please enter your username: ") password=raw_input("Please enter your password: ") if username == "john doe" and password == "fopwpo": print "Login Successful" else: print "Please try again" -- http://mail.python.org/mailman/listinfo/

Re: Loop Question

2013-06-23 Thread christhecomic
I'm using 2.7 -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop Question

2013-06-23 Thread Steven D'Aprano
On Sun, 23 Jun 2013 16:18:35 -0700, christhecomic wrote: > How do I bring users back to beginning of user/password question once > they fail it? thx Write a loop. If they don't fail (i.e. they get the password correct), then break out of the loop. -- Steven -- http://mail.python.org/mailman/

Re: Loop Question

2013-06-23 Thread rurpy
On 06/23/2013 05:18 PM, christheco...@gmail.com wrote: > How do I bring users back to beginning of user/password question once they > fail it? thx This is not a very good question. There is no context so we cannot tell if you are talking about a command line program that prompts for a username

Loop Question

2013-06-23 Thread christhecomic
How do I bring users back to beginning of user/password question once they fail it? thx -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter event loop question

2008-08-30 Thread gordon
On Aug 29, 10:46 pm, "Russell E. Owen" <[EMAIL PROTECTED]> wrote: you > can safely compute stuff with a background thread and display it from> the > main thread). But cross that bridge later.> > -- Russell thanks Russel gordon -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter event loop question

2008-08-29 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, gordon <[EMAIL PROTECTED]> wrote: > On Aug 29, 4:45 am, "Russell E. Owen" <[EMAIL PROTECTED]> wrote: > >your Controller object should not create root nor should > > it call mainloop to start the event loop. > > guys > thanks for the helpful replies..I rewrote the

Re: Tkinter event loop question

2008-08-29 Thread gordon
On Aug 29, 4:45 am, "Russell E. Owen" <[EMAIL PROTECTED]> wrote: >your Controller object should not create root nor should > it call mainloop to start the event loop. guys thanks for the helpful replies..I rewrote the code as you advised. It creates a controller object and a gui object from main s

Re: Tkinter event loop question

2008-08-28 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, gordon <[EMAIL PROTECTED]> wrote: > On Aug 27, 10:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > so I guess the question here is from where you expect to call that > > method, and what you expect Tkinter to do when you call it... > > thanks for the reply >

Re: Tkinter event loop question

2008-08-28 Thread gordon
On Aug 27, 10:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > so I guess the question here is from where you expect to call that > method, and what you expect Tkinter to do when you call it... thanks for the reply i was planning to write a controller (as in MVC) that will instantiate a gui clas

Re: Tkinter event loop question

2008-08-27 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >gordon wrote: > >> is it possible to send a message to the gui instance while the Tk >> event loop is running?I mean after i create a gui object like . .

Re: Tkinter event loop question

2008-08-27 Thread Fredrik Lundh
gordon wrote: is it possible to send a message to the gui instance while the Tk event loop is running?I mean after i create a gui object like root=Tk() mygui=SomeUI(root) and call root.mainloop() can i send message to mygui without quitting the ui or closing the window?i tried some code like

Tkinter event loop question

2008-08-27 Thread gordon
is it possible to send a message to the gui instance while the Tk event loop is running?I mean after i create a gui object like root=Tk() mygui=SomeUI(root) and call root.mainloop() can i send message to mygui without quitting the ui or closing the window?i tried some code like mygui.someMethod(

Re: newbie: for loop within for loop question

2008-06-15 Thread Calvin Spealman
The sets module is no longer needed, as we have the built-in sets type. Its even getting a literal syntax soon. As for the original problem, I agree on the homework smell. On Jun 15, 2008, at 9:31 PM, takayuki wrote: Dennis, thanks for your reply. unfortunately i accidentally posted only h

Re: newbie: for loop within for loop question

2008-06-15 Thread takayuki
Dennis, thanks for your reply. unfortunately i accidentally posted only half of my question! the "real" post should be up now. my apologies. takayuki On Jun 16, 10:15 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 15 Jun 2008 17:18:54 -0700 (PDT), takayuki > <[EMAIL PROTECTED]> d

newbie: for loop within for loop question

2008-06-15 Thread takayuki
Hi everyone, I'm studying python via the excellent "how to think like a python programmer" book by Allen Downey. Noob question follows... I have a txt file (animals.txt) which contains the following text each on a separate line: aardvark, bat, cat, dog, elephant, fish, giraffe, horse, inchworm,

Re: Regex loop question

2008-03-03 Thread Peter Otten
Mike P wrote: > Hi Experts, > > I've written a peice of code that works fine and fits, and passes > values into a peice of SPSS code, the problem is that it is not > dynamic, and so i though about how i can make it dynamic, (other code > may not have upto 10 some may have more) and came up with r

Regex loop question

2008-03-03 Thread Mike P
Hi Experts, I've written a peice of code that works fine and fits, and passes values into a peice of SPSS code, the problem is that it is not dynamic, and so i though about how i can make it dynamic, (other code may not have upto 10 some may have more) and came up with regex for an idea, but i can

Re: for loop question

2007-10-11 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> >>> pairs = (test[i:i+2] for i in xrange(len(test)-1)) > >> >>> for a,b in pairs: > >> ... print a,b > > > > for a, b in zip(test, test[1:]): > > print a, b > > May be unfortunately slow if test is half a gigabyte of data, what with > ess

Re: for loop question

2007-10-11 Thread Paul Hankin
On Oct 11, 4:40 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 10 Oct 2007 20:25:00 +, Paul Hankin wrote: > >> A "works-for-me": > > >> >>> pairs = (test[i:i+2] for i in xrange(len(test)-1)) > >> >>> for a,b in pairs: > >> ... print a,b > > > for a, b in zip(

Re: for loop question

2007-10-10 Thread Steven D'Aprano
On Wed, 10 Oct 2007 20:25:00 +, Paul Hankin wrote: >> A "works-for-me": >> >> >>> pairs = (test[i:i+2] for i in xrange(len(test)-1)) >> >>> for a,b in pairs: >> ... print a,b > > for a, b in zip(test, test[1:]): > print a, b May be unfortunately slow if test is half a gigabyte of da

Re: for loop question

2007-10-10 Thread Robert Dailey
On 10/10/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > > Instead of passing the file object directly to the csv parser, pass in a > generator that reads from the file and explicitly encodes the strings > into UTF-8, along these lines: > > def encode_to_utf8(f): > for line in f: > yield

Re: for loop question

2007-10-10 Thread Carsten Haese
On Wed, 2007-10-10 at 16:03 -0500, Robert Dailey wrote: > I've tried everything to make the original CSV module work. It just > doesn't. I've tried UTF-16 encoding What do you mean, "tried?" Don't you know what the file is encoded in? > (which works fine with codecs.open()) but when I pass in th

Re: for loop question

2007-10-10 Thread Robert Dailey
I've tried everything to make the original CSV module work. It just doesn't. I've tried UTF-16 encoding (which works fine with codecs.open()) but when I pass in the file object returned from codecs.open() into csv.reader(), the call to reader.next() fails because it says something isnt' in the rang

Re: for loop question

2007-10-10 Thread Larry Bates
Tim Chase wrote: >> test = u"Hello World" >> >> for cur,next in test: >> print cur,next >> >> Ideally, this would output: >> >> 'H', 'e' >> 'e', 'l' >> 'l', 'l' >> 'l', 'o' >> etc... >> >> Of course, the for loop above isn't valid at all. I am just giving an >> example of what I'm trying to acc

Re: for loop question

2007-10-10 Thread George Sakkis
On Oct 10, 4:12 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > test = u"Hello World" > > > for cur,next in test: > > print cur,next > > > Ideally, this would output: > > > 'H', 'e' > > 'e', 'l' > > 'l', 'l' > > 'l', 'o' > > etc... > > > Of course, the for loop above isn't valid at all. I am just

Re: for loop question

2007-10-10 Thread Tim Chase
Paul Hankin wrote: > On Oct 10, 9:12 pm, Tim Chase <[EMAIL PROTECTED]> wrote: >> >>> pairs = (test[i:i+2] for i in xrange(len(test)-1)) >> >>> for a,b in pairs: >> ... print a,b > > for a, b in zip(test, test[1:]): > print a, b Very nice! I second this solution as better than my original

Re: for loop question

2007-10-10 Thread Rafael Sachetto
Very nice solution :) On 10/10/07, Paul Hankin <[EMAIL PROTECTED]> wrote: > > On Oct 10, 9:12 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > > test = u"Hello World" > > > > > for cur,next in test: > > > print cur,next > > > > > Ideally, this would output: > > > > > 'H', 'e' > > > 'e', 'l' > > >

Re: for loop question

2007-10-10 Thread Robert Dailey
All the ideas presented here are workable. I definitely have a lot of solutions to choose from. Thanks everyone for your help. I wasn't sure if there was some sort of language feature to naturally do this, so I had to post on the mailing list to make sure. -- http://mail.python.org/mailman/listinf

Re: for loop question

2007-10-10 Thread Paul Hankin
On Oct 10, 9:12 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > test = u"Hello World" > > > for cur,next in test: > > print cur,next > > > Ideally, this would output: > > > 'H', 'e' > > 'e', 'l' > > 'l', 'l' > > 'l', 'o' > > etc... > > > Of course, the for loop above isn't valid at all. I am just

Re: for loop question

2007-10-10 Thread Carsten Haese
On Wed, 2007-10-10 at 14:56 -0500, Robert Dailey wrote: > Hi, > > I'm currently writing my own CSV parser since the built in one doesn't > support Unicode. Why do you think you need a CSV parser that supports unicode? -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.o

Re: for loop question

2007-10-10 Thread Tim Chase
> test = u"Hello World" > > for cur,next in test: > print cur,next > > Ideally, this would output: > > 'H', 'e' > 'e', 'l' > 'l', 'l' > 'l', 'o' > etc... > > Of course, the for loop above isn't valid at all. I am just giving an > example of what I'm trying to accomplish. Anyone know how I c

Re: for loop question

2007-10-10 Thread Rafael Sachetto
Try this: test = u"Hello World" n = range(len(test)) for i in n: cur = test[i] try: next = test[i+1] except: next = "" print cur, next just On 10/10/07, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm currently writing my own CSV parser since the built in on

for loop question

2007-10-10 Thread Robert Dailey
Hi, I'm currently writing my own CSV parser since the built in one doesn't support Unicode. I'm wondering if there's a way to iterate over the characters in a unicode string and have access to both the 'current' and the 'next' characters each iteration. For example: test = u"Hello World" for cur

Re: Tkinter, main loop question.

2006-11-23 Thread Bjoern Schliessmann
Exod wrote: > Don't know if its possible in this light-weight GUI toolset, but > can i somehow hook up into the mainloop in it, for example if i > were to create an internet application, i would need to keep > recieving data from within it? That's something where you could try the Twisted framewo

Re: Tkinter, main loop question.

2006-11-22 Thread Hendrik van Rooyen
"Exod" <[EMAIL PROTECTED]> wrote: > Don't know if its possible in this light-weight GUI toolset, but can i > somehow hook up into the mainloop in it, for example if i were to > create an internet application, i would need to keep recieving data > from within it? Its possible - use the call back

Tkinter, main loop question.

2006-11-22 Thread Exod
Don't know if its possible in this light-weight GUI toolset, but can i somehow hook up into the mainloop in it, for example if i were to create an internet application, i would need to keep recieving data from within it? -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop question

2006-07-06 Thread York
for a in range(2, len(foo)): print a or maybe you need for a in range(1, len(foo)): print a ? York bruce wrote: > hi.. > > basic foor/loop question.. > > i can do: > > for a in foo > print a > > if i want to do something like > for a, 2, foo >

Re: for loop question

2006-07-06 Thread Daniel Haus
> Except that in the OP's example foo was a sequence, not an > integer. I think. Yes, possibly. But then, what's "from 2 to foo"? this way it might be for a in [2] + foo: print a -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop question

2006-07-06 Thread Grant Edwards
On 2006-07-06, Daniel Haus <[EMAIL PROTECTED]> wrote: >> i can do: >> >> for a in foo >> print a >> >> if i want to do something like >> for a, 2, foo >> print foo >> >> where go from 2, to foo.. > just do: > > for a in range(2, foo+1): > print a Except that in the OP's example foo

RE: for loop question

2006-07-06 Thread bruce
'ppreaciate the answers duh... -bruce -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Daniel Haus Sent: Thursday, July 06, 2006 2:02 PM To: python-list@python.org Subject: Re: for loop question just do: for a in range(2, foo+1): print a

Re: for loop question

2006-07-06 Thread Daniel Haus
just do: for a in range(2, foo+1): print a range(a, b) gives [a, a+1, a+2, ..., b-2, b-1] bruce schrieb: > hi.. > > basic foor/loop question.. > > i can do: > > for a in foo > print a > > if i want to do something like > for a, 2, foo > p

Re: for loop question

2006-07-06 Thread Preston Hagar
On 7/6/06, bruce <[EMAIL PROTECTED]> wrote: hi..basic foor/loop question..i can do: for a in foo  print aif i want to do something like  for a, 2, fooprint foowhere go from 2, to foo..i can't figure out how to accomplish this... can someone point me to how/where this is demonst

for loop question

2006-07-06 Thread bruce
hi.. basic foor/loop question.. i can do: for a in foo print a if i want to do something like for a, 2, foo print foo where go from 2, to foo.. i can't figure out how to accomplish this... can someone point me to how/where this is demonstrated... found plenty of google fo

Re: Asyncore Loop Question

2005-10-31 Thread Steve Holden
John W wrote: > On 10/31/05, Steve Holden <[EMAIL PROTECTED]> wrote: > >>John W wrote: >> >>>Hello, >>> >>>I have a gui application where I am trying to use the asyncore module to >>>gather data from other computers. I am able to connect, but I am getting >>>constant handle_write_event method call

Re: Asyncore Loop Question

2005-10-31 Thread John W
Steve, Ar you saying that I should close the connection until I have data to write?  Or should I be using the readable and writable methods to turn it off? Thanks for your help, unfortunatly, I have struggled with the documentation and getting a clear understanding of everything.  This is my firs

Re: Asyncore Loop Question

2005-10-31 Thread Steve Holden
John W wrote: > Hello, > > I have a gui application where I am trying to use the asyncore module to > gather data from other computers. I am able to connect, but I am getting > constant handle_write_event method calls into my application. It is > obviously slowing down the gui processing significa

Asyncore Loop Question

2005-10-31 Thread John W
Hello, I have a gui application where I am trying to use the asyncore module to gather data from other computers.  I am able to connect, but I am getting constant handle_write_event method calls into my application.  It is obviously slowing down the gui processing significantly. My understanding