Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Monday, 23 January 2006 at 10:59:24 +1100, Shuying Wang wrote: > I'm guessing when you did that, you got something like an IndexError. > That's because you didn't check the length of "a" from raw_input and > accessed a nonexistent array element (a string is an array of > characters). So if you c

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Sunday, 22 January 2006 at 18:11:09 -0600, Hugo González Monteverde wrote: > Hi Vincent, > > > the program works with any input except when you just hit the enter key. > > > To be able to understand why is the crash, take a look at what the > interpreter tells you: > > > File "untitled.p

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Sunday, 22 January 2006 at 16:07:06 -0800, bob wrote: > At 03:46 PM 1/22/2006, Vincent Zee wrote: > >Why will this little program crash when you enter the enter key? > > Thank you for including the "traceback" message in your 2nd post. > > Index error means yo

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Sunday, 22 January 2006 at 15:54:06 -0800, Danny Yoo wrote: > > > Why will this little program crash when you enter the enter key? > > [program cut] > > Hi Vincent, > > What do you mean by "crash"? Do you get an error message? If so, can you > show us? > > > It will also help to think to

[Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
Hi all, I'm puzzled (:-)) Why will this little program crash when you enter the enter key? while True: a = raw_input('number? ') if a.isdigit(): print 'isdigit' elif a[0] == '-' and a[1:].isdigit(): print '- + isdigit' elif a == 'q': break else:

Re: [Tutor] How to get terminal settings

2006-01-20 Thread Vincent Zee
On Thursday, 19 January 2006 at 23:53:06 -, Alan Gauld wrote: > Assuming you are on a Unix style OS/terminal you can read the > output of stty. Look at the rows value > > Here are a couple of runs of rows at different terminal sizes: > > $ stty -a | grep rows > speed 38400 baud; rows 41; col

Re: [Tutor] How to get terminal settings

2006-01-20 Thread Vincent Zee
On Thursday, 19 January 2006 at 16:03:16 -0800, Terry Carroll wrote: > On Thu, 19 Jan 2006, Vincent Zee wrote: > > > Any pointers to other curses howto's? > > There's http://heather.cs.ucdavis.edu/~matloff/Python/PyCurses.pdf ; but > it's mostly a couple o

Re: [Tutor] How to get terminal settings

2006-01-19 Thread Vincent Zee
On Thursday, 19 January 2006 at 12:37:38 -0800, Danny Yoo wrote: > > > On Thu, 19 Jan 2006, Vincent Zee wrote: > > > say you want to write a more-like program. How do you know how many > > lines the terminal window can display. > > Hi Vincent, > > It&#x

Re: [Tutor] How to get terminal settings

2006-01-19 Thread Vincent Zee
On Thursday, 19 January 2006 at 11:29:29 -0800, Bill Campbell wrote: > On Thu, Jan 19, 2006, Vincent Zee wrote: > >Hi, > > > >say you want to write a more-like program. > >How do you know how many lines the terminal window > >can display. > > Use the curses

[Tutor] How to get terminal settings

2006-01-19 Thread Vincent Zee
Hi, say you want to write a more-like program. How do you know how many lines the terminal window can display. /\ Vincent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor