Re: [Tutor] pexpect

2008-09-20 Thread Steve Poe
James, I've not used pexpect, but I've done this on a Cisco switch. I found using time.sleep and read_until of the telnet class to be helpful. 10 tn = telnetlib.Telnet('') 11 #tn.set_debuglevel(9) 12 tn.read_until('Username: \xff', 5) 13 time.sleep(10) 14 tn.write('\

Re: [Tutor] Scan Directory for files

2008-08-02 Thread Steve Poe
Fred, What is/are the exact error message(s)? You may want to look at the module glob. Steve Ar e you typing this in the python interpreter or On Aug 1, 2008, at 10:41 PM, Fred @ Mac wrote: Hello, new to python, so please go easy on me! I am using for f in os.listdir(watch_dir):

[Tutor] key/value order in dictionaries

2008-07-30 Thread Steve Poe
Hi tutor list, In dictionaries, I know that the keys are immutable, and the values can change What about the place/order of the key/order? I thought that they were sequential and they do not change. >>> D={"AAA":1234,"BBB":3456,"CCC":7890} >>> print D {'AAA': 1234, 'BBB': 3456, 'CCC': 7890} >

Re: [Tutor] understanding join

2008-07-30 Thread Steve Poe
Say I have a sequence seq and a string s, and I call s.join(seq). Here's what it does: s.join(seq) == seq[0] + s + seq[1] + s + seq[2] + s + ... + seq[-2] + s + seq[-1] So if you call 'abc'.join('ABC'), you get: 'ABC'[0] + 'abc' + 'ABC'[1] + 'abc' + 'ABC'[2] which is: 'A' + 'abc' + 'B'

Re: [Tutor] understanding join

2008-07-30 Thread Steve Poe
Does this look useful? In [3]: people = [ 'Tom', 'Dick', 'Harry' ] In [4]: ', '.join(people) Out[4]: 'Tom, Dick, Harry' Your confusion is in thinking about the string 'ABC' as a single entity. For the purposes of join(), it is a sequence of three letters. The argument to join() is a sequence of

Re: [Tutor] checking for expected types from input file

2008-07-30 Thread Steve Poe
Bryan, How about checking your input to see if they are digits or not? >>> input_data = '123ABC' >>> print input_data.isdigit() False >>> input_data = '1234567889' >>> print input_data.isdigit() True >>> input_data = '123ABC' >>> print input_data.isdigit() False or something like: while INPUT.h

[Tutor] understanding join

2008-07-30 Thread Steve Poe
Hi tutor list, Just trying to add some clarity to the built-in function strings using join. The Python help screen says it returns a string which is a concatenation of strings in sequence. I am concatenating the string I am working on that maybe an issue of its own. Here's my example: stri

Re: [Tutor] Online class/education for Python?

2008-07-20 Thread Steve Poe
Joe > > > > On Sun, Jul 20, 2008 at 1:08 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 02:45 PM 7/19/2008, David wrote: > >> > >> Steve Poe wrote: > >>> > >>> Anyone taken or know of any online classes > >>> tea

[Tutor] Online class/education for Python?

2008-07-19 Thread Steve Poe
Anyone taken or know of any online classes teaching Python? I know O'Reilly Press teaches online technical courses, through the University of Illinois, but no Python . Thanks. Steve ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/

[Tutor] Guidance on jump-starting to learn Python

2008-07-17 Thread Steve Poe
I have the challenge / opportunity to learn Python quickly. I am technically-minded, but I am not a programmer. When I have tried / used Python before (I've written 5-6 python programs/utilities), it has been solving a particular issue but not learning the proper structure/procedures to learn Pytho