[Tutor] Is a link broken?

2013-01-11 Thread Ed Owens
I'm still working through Chun's Core Python Applications. I got the web crawler (Example 9-2) working after I found a ':' typing error. Now I'm trying to convert that to a program that checks for broken links. This is not in the book. The problem I'm having now is knowing whether a link

[Tutor] Flow charts

2013-01-09 Thread Ed Owens
I'm working my way through Chun's book Core Python Applications Programming and can't get one of the examples to actually work. In trying to analyze the problem (good learning approach) I had troubles understanding the interactions between the two classes of objects. As an old FORTRAN

[Tutor] Documentation

2013-01-06 Thread Ed Owens
I have been working my way through Chun's book /Core Python Applications. /In chapter 9 he has a web crawler program that essentially copies all the files from a web site by finding and downloading the links on that domain. One of the classes has a procedure definition, and I'm having

[Tutor] reading web page with BeautifulSoup

2012-12-12 Thread Ed Owens
from urllib2 import urlopen page = urlopen('w1.weather.gov/obhistory/KDCA.html') Traceback (most recent call last): File stdin, line 1, in module File /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py, line 126, in urlopen return _opener.open(url,

Re: [Tutor] reading web page with BeautifulSoup

2012-12-12 Thread Ed Owens
On 12/12/12 9:03 PM, Dave Angel wrote: On 12/12/2012 08:47 PM, Ed Owens wrote: from urllib2 import urlopen page = urlopen('w1.weather.gov/obhistory/KDCA.html') Traceback (most recent call last): File stdin, line 1, in module File /System/Library/Frameworks/Python.framework/Versions/2.7

[Tutor] Regular expressions question

2012-12-05 Thread Ed Owens
str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)', str(string)) print m None I'm sort of embarrassed to ask this, but I've been staring at this regular expression

Re: [Tutor] Regular expressions question

2012-12-05 Thread Ed Owens
On 12/5/12 7:24 PM, Brett Ritter wrote: On Wed, Dec 5, 2012 at 4:13 PM, Ed Owens eowens0...@gmx.com mailto:eowens0...@gmx.com wrote: str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s

Re: [Tutor] FW: (no subject)

2012-11-30 Thread Ed Owens
Hi, im trying to write a script which randomly generates 10,000 points(x,y) in the unit square(so range between 0 and 1 for both x and y). so far I have written the code below in red, however it only produces one random point. How do I get it to repeat this so it produces 10,000 different random

[Tutor] Python books

2012-11-09 Thread Ed Owens
I've been trying to learn Python, writing a Blackjack program. Seems that's a common problem for learning. I'm not in a class or school, just working on my own. I've been working in Python 2.7, and considering moving up to 3.x. My programming background is ancient, having done most of my

[Tutor] iterating over a changing list

2012-10-10 Thread Ed Owens
I'm trying to iterate over a list of elements, and make changes to the list in front of the element I'm currently working with. I can update the list, but the 'for' doesn't see the new element. Here's the code: import string def add_element(items, point): items = items[:point+1][:] +

[Tutor] modifying lists of lists

2012-10-03 Thread Ed Owens
I'm just learning Python, so I apologize for a newby question. I'm trying to work with lists of lists, the lowest level of which hold one or more tuples. I've tried to condense what I've tried. The code is: #! Python 2.7 import copy list = [] for i in range(8): list.append((i, i+1)) H =

Re: [Tutor] modifying lists of lists

2012-10-03 Thread Ed Owens
You are fundamentally correct about my confusion, though I'm trying to work with tuples as the lowest level, which may not be relevant here. -Original Message- . py H = [[1, 2]] py J = [H[0]] py print H [[1, 2]] py print J [[1, 2]] py H[0][0] = 99 py print H # expected, and got, [[99,