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 such: apple john bean joke ample python nice

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, the OP indicated that he needed to process the keys in that particular

[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

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 nice ample joke and this is what works

Re: [Tutor] A replacement for a for loop

2007-08-29 Thread Scott Oertel
'Attribute %s has value %s' % (key, attrs[key]) Why even have the keys variable at all.. for key in attrs: print 'Attribute %s has value %s' % (key, attrs[key]) -Scott Oertel ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

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

2007-06-22 Thread Scott Oertel
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. -Scott Oertel ___ Tutor maillist - Tutor@python.org http

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

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

2005-09-06 Thread Scott Oertel
. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor Try using py2exe it works pretty well for compiling .py into a portable .exe distribution. http://starship.python.net/crew/theller/py2exe/ -Scott Oertel

[Tutor] mod_python.publisher

2005-09-02 Thread Scott Oertel
che/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, but ins

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 need to search for something and insert, what, before it Here's

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 = [] while (cnt number[1][0

[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 :) -Scott Oertel -Py2.4

Re: [Tutor] Working with files

2005-08-24 Thread Scott Oertel
hon.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 __

[Tutor] Counting help

2005-08-23 Thread Scott Oertel
. -Scott Oertel ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Counting help

2005-08-23 Thread Scott Oertel
, 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 would