Re: [Tutor] "#!/usr/bin/env python" vs "#!/usr/local/bin/python"

2007-06-22 Thread Scott Oertel
at you have to either A) make sure the environment is initialized, or B) initialize the environment manually before executing the script. If you, for example, want to use a python script at boot time, before the environment is initialized, i strongly recommend using an absolute path. -Sc

Re: [Tutor] A replacement for a "for" loop

2007-08-29 Thread Scott Oertel
quot;for" loop causes the >> dictionary keys to be read in a certain order. How could I take away the >> first "for" loop and replace it with something else to do the same general >> function? >> > > for key in keys: > print 'Attribute %s has

Re: [Tutor] A replacement for a "for" loop

2007-08-30 Thread Scott Oertel
Terry Carroll wrote: > On Wed, 29 Aug 2007, Scott Oertel wrote: > > >> Why even have the keys variable at all.. >> >> for key in attrs: >> print 'Attribute %s has value %s' % (key, attrs[key]) >> > > In a prior email thread, th

[Tutor] Formatting output into columns

2007-08-30 Thread Scott Oertel
Someone asked me this question the other day, and I couldn't think of any easy way of printing the output besides what I came up with pasted below. So what you have is a file with words in it as such: apple john bean joke ample python nice and you want to sort and output the text into columns as

Re: [Tutor] Formatting output into columns

2007-08-30 Thread Scott Oertel
Alan Gauld wrote: > "Scott Oertel" <[EMAIL PROTECTED]> wrote > > >> and you want to sort and output the text into columns as such: >> >> a p j b n >> apple python john bean

Re: [Tutor] Formatting output into columns

2007-08-31 Thread Scott Oertel
Luke Paireepinart wrote: > Scott Oertel wrote: >> Someone asked me this question the other day, and I couldn't think of >> any easy way of printing the output besides what I came up with pasted >> below. >> >> So what you have is a file with words in it as suc

[Tutor] Counting help

2005-08-23 Thread Scott Oertel
s my first post to this list, I hope I included enough information. -Scott Oertel ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Counting help

2005-08-23 Thread Scott Oertel
or the snipplet, it's perfect for what I'm doing, I wasn't aware of the has_key() or get(), this is very usefull. -Scott Oertel ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Counting help

2005-08-23 Thread Scott Oertel
Scott Oertel wrote: Byron wrote: Luis N wrote: Ideally, you would put your names into a list or dictionary to make working with them easier. If all you're trying to do is count them (and your list of names is long), you might consider a dictionary which you

Re: [Tutor] Counting help

2005-08-23 Thread Scott Oertel
Scott Oertel wrote: Byron wrote: Luis N wrote: Ideally, you would put your names into a list or dictionary to make working with them easier. If all you're trying to do is count them (and your list of names is long), you might consider a dictionary which you

Re: [Tutor] Counting help

2005-08-24 Thread Scott Oertel
Kent Johnson wrote: Scott Oertel wrote: The next problem I have though is creating the dict, i have a loop, but i can't figure out how to compile the dict, it is returning this: ('Joey Gale', ('Scott Joe', 'This is lame' ))) listofnames = []

[Tutor] Working with files

2005-08-24 Thread Scott Oertel
How do I use the built in file objects to insert text into a file at a certain location? i.e. something, 2, chance, weee nothing, happened, crap, nice need to search for "something" and insert, "what," before it thanks for the feedback you guys are great :)

Re: [Tutor] Working with files

2005-08-24 Thread Scott Oertel
//mail.python.org/mailman/listinfo/tutor Thanks again, I figured it out with the index function of the file objects, I didn't know that you could search for a word and find the exact pos of it, that was the tiny bit of information I was looking for. -Scott Oertel ___

Re: [Tutor] Working with files

2005-08-25 Thread Scott Oertel
Bob Gailer wrote: > At 02:55 PM 8/24/2005, Scott Oertel wrote: > >> How do I use the built in file objects to insert text into a file at a >> certain location? >> >> i.e. >> >> something, 2, chance, weee >> nothing, happened, crap, nice >> &g

[Tutor] mod_python.publisher

2005-09-02 Thread Scott Oertel
x27;m running Apache/1.3.33 (Unix) mod_python/2.7.11 Python/2.2.3 -Scott Oertel ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] mod_python.publisher

2005-09-02 Thread Scott Oertel
Scott Oertel wrote: I'm having an issue with mod_python.publisher, supposedly i should be able to just place this code def index():    return "This is only a test." into test.py and when placed into my browser it should run the index function by default, bu

Re: [Tutor] CREATING A PR.EXE FROM A PR.PY

2005-09-05 Thread Scott Oertel
stribution. http://starship.python.net/crew/theller/py2exe/ -Scott Oertel ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Opening files, finding their location

2005-10-08 Thread Scott Oertel
I have a small problem with one of my scripts currently, I'm using the config parser to open a config.ini file, but this program is going to be designed to be used as a cron job, currently i made a work around.. ./program.py config.ini is how you run it from the command line I'm looking for an

Re: [Tutor] Opening files, finding their location

2005-10-08 Thread Scott Oertel
Christopher Arndt wrote: Scott Oertel schrieb: I'm looking for an easy way to find the current directory location of my program so I can include the config.ini file correctly without having to pass command line args. So, do you want to find out, where your scri

Re: [Tutor] code improvement for beginner ?

2005-10-11 Thread Scott Oertel
lmac wrote: > --- > >The problem with downloading the images is this: > >- >http://images.nfl.com/images/globalnav-shadow-gray.gif >Traceback (most recent call last): > File "/home/internet/bin/nflgrab.py", line 167, in ? >urllib.urlretrieve(img,img[f:]) > File "/usr/

Re: [Tutor] Can anyone teach me...?

2005-10-13 Thread Scott Oertel
d I  can go back to using wxPython instead. Boa constructor always crashes on me in linux, on windows it's nice, but I make one small change in the code and boaconstructor will freak out and not be able to read anything. that's just my experience. -- scott oertel gawr.com :) ___