Re: [Tutor] handling of tabular data

2005-10-09 Thread Alan Gauld
> with the little I know about classes, I assume that then I would have > a list of class instances as representation of my tabular data > but given such a list of class instances, i would still need for > loops to get to e.g. the minimal value of a certain attribute in all > classes in that list.

Re: [Tutor] code improvement for beginner ?

2005-10-09 Thread Roel Schroeven
Danny Yoo wrote: > Looking at pageimgs(): I'm not sure what 't' means in the open statement: > > f = open(filename, "rt") > > and I think that 't' might be a typo: I'm surprised that Python doesn't > complain. Can anyone confirm this? I think you may have tried to do "r+" > mode, but even

Re: [Tutor] handling of tabular data

2005-10-09 Thread Pujo Aji
Hi Frank,   you can use Numeric.py it is also powerfull to handle averages, min, max, matrix algebra, etc.. see: http://www.pfdubois.com/numpy/   You just need to use a list.   If your data is big and you need more power I suggest you use database like mysqldb for python. It is also fun to combine

Re: [Tutor] AttributeError: 'str' object has no attribute 'geturl'

2005-10-09 Thread Joseph Quigley
Javier wrote: > Class Data has a class attribute, 'f', defined as an empty string. Check if > Data.f is initialized before calling getImg. > Also, why initialize with an empty str? Put a None in there or don't define > the attribute at all. > A tip: in line 126 there is a print Data.f. This

Re: [Tutor] AttributeError: 'str' object has no attribute 'geturl'

2005-10-09 Thread Joseph Quigley
Ok, new version (sorry to bug you). This time I've edited the program so that you can only download todays (it won't work for any other date). Now I can connect to the server but it sticks on "Downloading image!" Thanks for your prevoius help. Joe #! /usr/bin/env python ###

[Tutor] Code Inspection

2005-10-09 Thread Daniel Watkins
Hey list, I've been working on my spider program (albeit not very much :P) and I would appreciate it if I could get some comments on the code. I'm fairly sure I haven't chosen the best method to do what I want to do, but if we can just assume that I have, that'll make things easier. ;) In particul

Re: [Tutor] subclass problem: __names and type-checking

2005-10-09 Thread Brian van den Broek
Python said unto the world upon 2005-10-08 12:32: Thanks for the response, Llyod. (And to Alan, too.) > I think that a sub-class *needs* to support the same programming > interface as the parent class. > If B inherits from A then every context where A or an A instance appears > should work co

Re: [Tutor] subclass problem: __names and type-checking

2005-10-09 Thread Brian van den Broek
Python said unto the world upon 2005-10-08 12:40: > Traceback (most recent call last): >File "C:/Python24/foofoofoo.py", line 26, in -toplevel- > s2 = Sub2() >File "C:/Python24/foofoofoo.py", line 22, in __init__ > super(Sub2, self).__init__() >File "C:/Python24/foofoofoo.py",

[Tutor] Regex help

2005-10-09 Thread Bill Burns
I'm looking to get the size (width, length) of a PDF file. Every pdf file has a 'tag' (in the file) that looks similar to this Example #1 MediaBox [0 0 612 792] or this Example #2 MediaBox [ 0 0 612 792 ] I figured a regex might be a good way to get this data but the whitespace (or no whitespac

Re: [Tutor] is there any Python code for spatial tessellation?

2005-10-09 Thread Shi Mu
There are four points with coordinates: 2,3;4,9;1,6;3,10. How to use Python to draw one perpendicular bisector between (2,3) and (4,9); the other perpendicular bisector between (1,6)和(3,10); then, makes the output like: l1 a b c l2 a b c (Note: l indicates the perpendicular bisector with equation a

[Tutor] line question

2005-10-09 Thread Shi Mu
There are four points with coordinates: 2,3;4,9;1,6;3,10. How to use Python to draw one perpendicular bisector between (2,3) and (4,9); the other perpendicular bisector between (1,6)和(3,10); then, makes the output like: l1 a b c l2 a b c (Note: l indicates the perpendicular bisector with equation a

Re: [Tutor] Regex help

2005-10-09 Thread bob
At 09:10 PM 10/9/2005, Bill Burns wrote: >I'm looking to get the size (width, length) of a PDF file. Every pdf >file has a 'tag' (in the file) that looks similar to this > >Example #1 >MediaBox [0 0 612 792] > >or this > >Example #2 >MediaBox [ 0 0 612 792 ] > >I figured a regex might be a good way

Re: [Tutor] Regex help

2005-10-09 Thread Andrew P
If the format is consistent enough,  you might get away with something like: >>> p = re.compile('MediaBox \[ ?\d+ \d+ (\d+) (\d+) ?\]') >>> print p.search(s).groups() ('612', '792') The important bits being:  ? means "0 or 1 occurences", and you can use parentheses to group matches, and they get