For_loops hurt my brain.

2008-07-16 Thread bsagert
This script uses a simple for loop to zip some files. However I am repeating code that cries out for a nested loop. My two lists of files_to_be_zipped (spare and seekfacts) are of uneven length so I can't seem to decipher the "for_logic". I would appreciate any help. Thanks, Bill import zipfile im

Python and decimal character entities over 128.

2008-07-09 Thread bsagert
Some web feeds use decimal character entities that seem to confuse Python (or me). For example, the string "doesn't" may be coded as "doesn’t" which should produce a right leaning apostrophe. Python hates decimal entities beyond 128 so it chokes unless you do something like string.encode('utf-8').

n00bie wants advice.

2008-07-01 Thread bsagert
This simple script writes html color codes that can be viewed in a browser. I used short form hex codes (fff or 000, etc) and my list has only six hex numbers otherwise the results get rather large. I invite criticism as to whether my code is "pythonic". Are there other ways to generate the hex co

Help me optimize my feed script.

2008-06-26 Thread bsagert
I wrote my own feed reader using feedparser.py but it takes about 14 seconds to process 7 feeds (on a windows box), which seems slow on my DSL line. Does anyone see how I can optimize the script below? Thanks in advance, Bill # UTF-8 import feedparser rss = [ 'http://feeds.feedburner.com/typepad/

My n00bie brain hurts after "Python setup.py install".

2008-06-21 Thread bsagert
I downloaded Mark Pilgrims's feedparser.py in a zipfile to my Windows machine, unzipped it and tried to install it to no avail. Here is the result => C:\>python c:\scripts\feedparser-4.1\setup.py install running install running build running build_py file feedparser.py (for module feedparser) not

Re: Importing module PIL vs beautifulSoup.

2008-06-18 Thread bsagert
On Jun 18, 10:18 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I downloaded BeautifulSoup.py from > >http://www.crummy.com/software/BeautifulSoup/and being a n00bie, I > > just placed it in my Windows c:\python25\lib\ file. When I type > > "import beautifulsoup" from th

Never mind folks, n00bie here forgot Python is case sensitive!

2008-06-18 Thread bsagert
On Jun 18, 10:18 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I downloaded BeautifulSoup.py from > >http://www.crummy.com/software/BeautifulSoup/and being a n00bie, I > > just placed it in my Windows c:\python25\lib\ file. When I type > > "import beautifulsoup" from th

Importing module PIL vs beautifulSoup.

2008-06-18 Thread bsagert
I downloaded BeautifulSoup.py from http://www.crummy.com/software/BeautifulSoup/ and being a n00bie, I just placed it in my Windows c:\python25\lib\ file. When I type "import beautifulsoup" from the interactive prompt it works like a charm. This seemed too easy in retrospect. Then I downloaded the

Please explain Python "__whatever__" construct.

2008-06-16 Thread bsagert
After a couple of weeks studying Python, I already have a few useful scripts, including one that downloads 1500 Yahoo stock quotes in 6 seconds. However, many things are puzzling to me. I keep on seeing things like "__main__" in scripts. A more obscure example would be "__add__" used in string con

Thanks for help re: %userprofile%

2008-06-10 Thread bsagert
The python community is very helpful to newbies like me. I did however manage to solve my problem in the meantime. I needed the modification time of certain files on various computers, but I didn't know the usernames ahead of time, so I used windows %userprofile% method. Python likes forward slash

Re: Python doesn't understand %userprofile%

2008-06-10 Thread bsagert
On Jun 10, 8:56 am, [EMAIL PROTECTED] wrote: > In xp when I try os.path.getmtime("%userprofile/dir/file%") Python > bites back with "cannot find the path specified" Since my script has > to run on machines where the username is unspecified I need a fix. > Thanks in advance. oops that should be os.

Python doesn't understand %userprofile%

2008-06-10 Thread bsagert
In xp when I try os.path.getmtime("%userprofile/dir/file%") Python bites back with "cannot find the path specified" Since my script has to run on machines where the username is unspecified I need a fix. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list