Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-02 Thread David Heiser
I believe you can submit the new config content as a blob where blob = string.join(lines). It looks like your "switch" uses IOS, not CatOS, so make sure you send "config t" first. And I would strip out the \r's. Then maybe: tn.write("\03") # Assures the device

[Tutor] Print list vs telnetlib.telnet.write differences

2006-03-02 Thread STREET Gideon (SPARQ)
Hi all, I've got the following snippet in a script I'm playing around with and need some help. Basically the script telnets to a cisco switch, "tn.read_until" a subsection of the config, outputs to a file, then using readlines brings it back into the script as a list where I'm changing some fiel

Re: [Tutor] Tutorial for creating web server

2006-03-02 Thread John Fouhy
On 03/03/06, Rakesh Mishra <[EMAIL PROTECTED]> wrote: > hi > > i wanted to create my own web server, can any body suggest any tutorial, > by the way i have gone through book Core Python Programing, in this book > one example is given but it is to abstract, that i am unable to understand Do you

[Tutor] Tutorial for creating web server

2006-03-02 Thread Rakesh Mishra
hi i wanted to create my own web server, can any body suggest any tutorial, by the way i have gone through book Core Python Programing, in this book one example is given but it is to abstract, that i am unable to understand . Thanks in advance rakesh __

Re: [Tutor] Environmental variables?

2006-03-02 Thread Alan Gauld
> You can do this by setting an environment variable named PYTHONSTARTUP to > name of a file containing your start-up commands > > How do I set environmental variables in Windows? If it's Windows 9x/Me use AUTOEXEC.BAT. SET PTYTHONSTARTUP C:\mypath\myfile.py If its Windows NT/2000/XP right click

[Tutor] Environmental variables?

2006-03-02 Thread Kermit Rose
In the primary tutor file, in section 2.2.4 The Interactive Startup File . It states: You can do this by setting an environment variable named PYTHONSTARTUP to the name of a file containing your start-up commands How do I set environmental variables in Windows? Kermit< [EM

Re: [Tutor] Sorting a list of objects on different fields

2006-03-02 Thread Terry Carroll
On Thu, 2 Mar 2006, Terry Carroll wrote: > Thanks, Kent! I didn't know about "key=". I see it's new in 2.4. > I was thinking I'd have to put in a method for each potentially sortable > field. And, in the spirit of RTFM, I should have been looking here first: http://wiki.python.org/moin/How

Re: [Tutor] Sorting a list of objects on different fields

2006-03-02 Thread Terry Carroll
On Thu, 2 Mar 2006, Kent Johnson wrote: > In [9]: lst.sort(key=attrgetter('b')); print lst Thanks, Kent! I didn't know about "key=". I see it's new in 2.4. I was thinking I'd have to put in a method for each potentially sortable field. ___ Tutor ma

Re: [Tutor] Sorting a list of objects on different fields

2006-03-02 Thread Kent Johnson
Terry Carroll wrote: > I have a list (or a list-like object, doesn't matter) of objects, each of > which has multiple fields. I want to be able to arbitrarily sort the list > on any of them, or at least on several of them. > > To make this a little more concrete, here's a simplified idea. Say th

[Tutor] Sorting a list of objects on different fields

2006-03-02 Thread Terry Carroll
I have a list (or a list-like object, doesn't matter) of objects, each of which has multiple fields. I want to be able to arbitrarily sort the list on any of them, or at least on several of them. To make this a little more concrete, here's a simplified idea. Say the objects each represent a fil

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Bob Gailer
Ben Vinger wrote: > Thanks to all who responded. I ended up using a sender parameter as > suggested by Andre and Alan, as this was very simple to do. When confronted with problems like this I tend to create classes, then subclass as needed for special circumstances. You might consider that app

Re: [Tutor] (no subject)

2006-03-02 Thread Terry Carroll
On Thu, 2 Mar 2006, Carroll, Barry wrote: > Go to > > http://catb.org/esr/faqs/hacker-howto.html#MS_hater > > and read Eric's excellent essay on hacking. If you're still interested, > come on back and we'll help you get started. And, as long as you're visiting Eric's site, check out

Re: [Tutor] doubt: 2nd part

2006-03-02 Thread Hugo González Monteverde
Hi Joaquin, Remember to Reply-All for the whole list to receive the message. Joaquin Sanchez Sanchez wrote: > Im proving pickle in python. > As I mentioned before, i do pickle.dump for two times, > because I want to save two dictionaries. > > Then to save the dictionaries, with one pickle.load()

Re: [Tutor] (no subject)

2006-03-02 Thread Carroll, Barry
Jacob, What, exactly, do you mean by 'hack'? The free dictionary wiktionary http://en.wiktionary.org/wiki gives the following definitions hack Verb to hack (third-person singular simple present hacks, present participle hacking, simple past hacked, past participle hacked) 1. To coug

[Tutor] More on Pickle

2006-03-02 Thread Hugo González Monteverde
Hi Joaquin, Make sure you hit Reply-all in your mail program, so the whole list can get the message. I'm forwarding for visibility anyway. >Thank you for your response, but now i have more >doubts: >the file must exist before that, or it can be created >at the same time I do th

Re: [Tutor] password protection in httplib

2006-03-02 Thread Kent Johnson
Andre Engels wrote: > Thanks for your help; it brought me quite a bit farther, but not as > far as I wanted to come. The authentication is basic authentication, > and I have been able to adapt the programs so that I now get my pages > correctly. > > However, the program uses not only 'GET' operati

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Ben Vinger
Thanks to all who responded.  I ended up using  a sender parameter as suggested by Andre and Alan, as this was very simple to do.   Ben   ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] (no subject)

2006-03-02 Thread Kent Johnson
Jacob Simonovich wrote: > I want to learn how to hack but don't know where to start. I have been > searching all over the internet to try to find things out but none of > the websites have helped me. I would like to know the tools needed and > just a step by step process on how to do it using

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Kent Johnson
Noufal Ibrahim wrote: > On Thu, March 2, 2006 3:55 pm, Ben Vinger wrote: > >>Hello >> >>I want myfunction in the pseudocode below return something different if it >>was called from indexfunction. > > > I'm new to this but maybe it would be good if you passed the appropriate > "version" of "myfun

Re: [Tutor] password protection in httplib

2006-03-02 Thread Andre Engels
Thanks for your help; it brought me quite a bit farther, but not as far as I wanted to come. The authentication is basic authentication, and I have been able to adapt the programs so that I now get my pages correctly. However, the program uses not only 'GET' operations, but also 'PUT' operations.

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Ewald Ertl
Hi Ben! After looking at the modules I detected the traceback-Module in my installation: >>> import traceback >>> def two(): ... one() ... >>> two() >>> def one(): ... print traceback.extract_stack() ... >>> def two(): ... one() ... >>> two() [('', 1, '?', None), ('', 2, 'two', None),

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Noufal Ibrahim
On Thu, March 2, 2006 3:55 pm, Ben Vinger wrote: > Hello > > I want myfunction in the pseudocode below return something different if it > was called from indexfunction. I'm new to this but maybe it would be good if you passed the appropriate "version" of "myfunction" to indexfunction from where t

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Alan Gauld
Ben, > I want myfunction in the pseudocode below return something > different if it was called from indexfunction. There are several approaches to this. > def indexfunction(): blah > > def myfunction(): >if : return x >else: return + x + The simplest approach simply includes a "

Re: [Tutor] How can a function know where it was called from

2006-03-02 Thread Andre Roberge
On 3/2/06, Ben Vinger <[EMAIL PROTECTED]> wrote: > > Hello > > I want myfunction in the pseudocode below return something different if it > was called from indexfunction. > How about adding a parameter to myfunction itself: def indexfunction(): blah myfunction(fromindexfunction=True) d

[Tutor] How can a function know where it was called from

2006-03-02 Thread Ben Vinger
Hello   I want myfunction in the pseudocode below return something different if it was called from indexfunction.   def indexfunction():    blah   def myfunction():   x = 'whatever'   if :  return x   else:  return + x +     Thanks Ben ___ Tuto

[Tutor] (no subject)

2006-03-02 Thread Jacob Simonovich
I want to learn how to hack but don't know where to start.  I have been searching all over the internet to try to find things out but none of the websites have helped me.  I would like to know the tools needed and just a step by step process on how to do it using widows xp home edition.