Re: [Tutor] Any good Glade and python tutorials?

2005-10-18 Thread Luis N
You might want to search for how it fits together with twisted's reactor http://www.google.com/search?q=twisted+glade+reactor Luis. On 10/15/05, Adam <[EMAIL PROTECTED]> wrote: > I'm making a Twisted app that needs a client side GUI and GTK seems like the > best way to go about this. Can anybody

Re: [Tutor] Python books: buying advice needed

2005-10-18 Thread Kent Johnson
David Stotijn wrote: > Hi, > > I'm planning on buying a book to help me learn Python. Some of the books > I'm considering are a few years old and based on an older version of > Python (e.g. 2.3). > Is it wise to buy a book based on an older version? Are the principles > and methods used in thos

Re: [Tutor] script to change device configuration

2005-10-18 Thread Kent Johnson
Chris Hallman wrote: I'm not very experienced with programming, writing > Python, using functions, OOP, etc., therefore I'd like to know if there > is a better way to do this: It looks pretty good to me. A few suggestions below. > import telnetlib, re, os, string > > dirpath = (r"c:\temp\sun")

Re: [Tutor] string.split() into a list

2005-10-18 Thread Randy Bush
>> >>> s='1|2|3|4' >> >>> l=s.split('|') >> >>> a, l = l[0], l[1:] >> >>> a >> '1' >> >>> l >> ['2', '3', '4'] i went with the above, or more specifically aList = line[:-1].split('|') netName, asList = aList[0], aList[1:] not gorgeous, but readable and my instinct for pinning a type

Re: [Tutor] string.split() into a list

2005-10-18 Thread Danny Yoo
On Tue, 18 Oct 2005, Kent Johnson wrote: > >l = [] > >a, l = string.split('|') > > How about > >>> s='1|2|3|4' > >>> l=s.split('|') > >>> a, l = l[0], l[1:] > >>> a > '1' > >>> l > ['2', '3', '4'] > ? Hi Randy, I think you're expecting Perl behavior. The Perl idiom for partiall

Re: [Tutor] string.split() into a list

2005-10-18 Thread Randy Bush
> How about > >>> s='1|2|3|4' > >>> l=s.split('|') > >>> a, l = l[0], l[1:] > >>> a > '1' > >>> l > ['2', '3', '4'] looks kinda readable. thanks randy ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] script question

2005-10-18 Thread Chris Hallman
Here is my latest revision, which works very well. # This Python script was written to forward interface down messages    # to ESM1. If the incoming arguements match the interface file # (c:\utils\interface.ini) then the message is forwarded. # # Author:    tcdh # Date:        09/22/05 #

[Tutor] script to change device configuration

2005-10-18 Thread Chris Hallman
I created a script that parses a directory, strips the ".txt" extension off the file, telnet & log on to the device (the filename is the device name), opens the associated ".txt" file, sends all the commands containted in the file to the device and then executes some commands to save the changes.

Re: [Tutor] Python books: buying advice needed

2005-10-18 Thread Gian Mario Tagliaretti
2005/10/18, David Stotijn <[EMAIL PROTECTED]>: > I'm planning on buying a book to help me learn Python. Some of the books > I'm considering are a few years old and based on an older version of Python > (e.g. 2.3). Python 2.3 is not so old... :) > Is it wise to buy a book based on an older versi

[Tutor] Python books: buying advice needed

2005-10-18 Thread David Stotijn
Hi, I'm planning on buying a book to help me learn Python. Some of the books I'm considering are a few years old and based on an older version of Python (e.g. 2.3). Is it wise to buy a book based on an older version? Are the principles and methods used in those books outdated by now? Ideally, the

Re: [Tutor] string.split() into a list

2005-10-18 Thread Randy Bush
> The string.split sends the list to a, but after that it's looking for > something to assign to l and there's nothing leftover from the command > for it to assign. nope, it does not send the list to a >>> l = [] >>> s = 'a|b' >>> t, l = s.split('|') >>> t 'a' >>> l 'b' i believe the problem is

Re: [Tutor] string.split() into a list

2005-10-18 Thread Kent Johnson
Randy Bush wrote: > maybe it's that i am actually doing > >l = [] >a, l = string.split('|') How about >>> s='1|2|3|4' >>> l=s.split('|') >>> a, l = l[0], l[1:] >>> a '1' >>> l ['2', '3', '4'] ? Kent > > ? > > ___ > Tutor maillist -

Re: [Tutor] string.split() into a list

2005-10-18 Thread Jason Massey
well that would definitely cause your error. The string.split sends the list to a, but after that it's looking for something to assign to l and there's nothing leftover from the command for it to assign. On 10/18/05, Randy Bush <[EMAIL PROTECTED]> wrote: > > >>> l = [] > > >>>a='1|2|3|4' > > >>>

Re: [Tutor] string.split() into a list

2005-10-18 Thread Randy Bush
> >>> l = [] > >>>a='1|2|3|4' > >>> l=a.split('|') > >>>l > ['1', '2', '3', '4'] >> and stupid question of the morning (for me) >> >> i want to string.split() into a sequence, a la >> >> l = [] >> l = myString.split('|') >> >> but, of course it whines about too many values. what is the >> comm

Re: [Tutor] "a cute recipe for getting the help command text"

2005-10-18 Thread Dick Moores
Ah, the line dest = open('cmd_help.txt', 'wb') Thanks, Kent. Yes, I've got it. Dick Kent Johnson wrote at 13:23 10/18/2005: >It makes a file called cmd_help.txt in the current directory. Did you >look for that? The file contains the result of asking for help on every >command. Kind of cool

Re: [Tutor] string.split() into a list

2005-10-18 Thread Jason Massey
Works fine for me: >>> l = [] >>>a='1|2|3|4' >>> l=a.split('|') >>>l ['1', '2', '3', '4'] On 10/18/05, Randy Bush <[EMAIL PROTECTED]> wrote: > and stupid question of the morning (for me) > > i want to string.split() into a sequence, a la > > l = [] > l = myString.split('|') > > but, of cours

[Tutor] string.split() into a list

2005-10-18 Thread Randy Bush
and stupid question of the morning (for me) i want to string.split() into a sequence, a la l = [] l = myString.split('|') but, of course it whines about too many values. what is the common way to do this? randy ___ Tutor maillist - Tutor@pytho

Re: [Tutor] "a cute recipe for getting the help command text"

2005-10-18 Thread Kent Johnson
It makes a file called cmd_help.txt in the current directory. Did you look for that? The file contains the result of asking for help on every command. Kind of cool! Kent Dick Moores wrote: > Found this in comp.lang.python. The Google link is >

Re: [Tutor] hand-holding for web development

2005-10-18 Thread nitin chandra
Thanks Jay On 10/18/05, Jay Loden <[EMAIL PROTECTED]> wrote: > You need an Apache config section to tell it what to use mod_python on and > how. For example, in httpd.conf or a separate file in your conf.d directory i guess the can be added only in one of the conf file. Which one should i add in

[Tutor] "a cute recipe for getting the help command text"

2005-10-18 Thread Dick Moores
Found this in comp.lang.python. The Google link is = import subprocess as subp p = subp.Popen("cmd.exe /X/D/F:ON", stdin=subp.PIPE, stdout=subp.PIPE, stderr=subp.STDOU

Re: [Tutor] multiple assignment

2005-10-18 Thread Kent Johnson
Vincent Gulinao wrote: > Haha. Cool. > > I think it's better than... > > if str.find(" "): > str1, str2, str3 = str.split(" ", 3) > else: > str1, str2, str3, rest = str, None, None, None Less buggy, too - your version will fail if str="1 2" or "1 2 3 4" BTW don't use str as the name of

Re: [Tutor] multiple assignment

2005-10-18 Thread Kent Johnson
Vincent Gulinao wrote: > I was fascinated when I learned that I can do this in Python: > > (str1, str2, str3, rest) = str.split(" ", 3) > > Later that I realize that str could contain values of less than 4 > strings, in which case it would complain something like -- ValueError: > unpack list of