[Tutor] HTML form post to Python script, without server

2005-03-29 Thread Bill Kranec
Hello, This might be slightly OT, but I hope I can get a few pointers. Is it possible to have an HTML form pass values to a Python script on a local computer, and execute that script? (I'm running Win XP, if that matters.) I would like to set up such a form to do some data entry. I understand th

Re: [Tutor] Whats so good about OOP ?

2005-03-12 Thread Bill Kranec
Hi Mark, In my brief experience with OOP, I would say that the main advantage is organization of code. All functions and attributes that you need to work with an object are wrapped up nicely inside the object. Also, object inheritance provides a great framework for easy customization. For examp

[Tutor] returning table elements with Beautiful Soup

2005-03-04 Thread Bill Kranec
Hi, I'm trying to use Beautiful Soup to scrape some data out of an HTML table. I can do this using table = soup("td", {'class' : 'yfnc_tabledata1' }) table[0].string.strip() However, if I try for entry in table: entry.string.strip() I get: AttributeError: Tag instance has no attribute 'string

Re: [Tutor] Criticism / Suggestions

2005-03-01 Thread Bill Kranec
Hi Kent, First off, thank you so much for the suggestions! They have helped clarify some of the concepts I've been struggling with lately ( mostly object - related ones ). I have been teaching myself Python in my spare time for the last few months, and have no previous programming experience,

[Tutor] Criticism / Suggestions

2005-02-28 Thread Bill Kranec
Hello, So I think that I've 'completed' my first real Python program, and I would appreciate any constructive criticism you all could offer. The program deals with a question that my Dad asked me awhile ago, which was "If twelve people want to divide into teams of two and play (golf) against e

Re: [Tutor] Method/subclass

2005-02-23 Thread Bill Kranec
This article might also be helpful, as it is a little more concrete: http://www.devx.com/dbzone/Article/22093. I found it by Googling for 'python database access object'. Is this the kind of thing that you are referring to, Kent? HTH, Bill Liam Clarke wrote: Kia ora, I'm not really sure

Re: [Tutor] DB design

2005-02-15 Thread Bill Kranec
Liam, I think what you want is called a view. A view is a memory based table defined by a query as follows: CREATE VIEW myview ( column1, column2, ... ) AS BEGIN SELECT * FROM table1 END; In this example, you can now SELECT * FROM myview, and get table1. You can put joined tables or

[Tutor] SQL Datetimes

2005-02-14 Thread Bill Kranec
Hello, I'm using Kinterbasdb to access a Firebird database through Python, and when I retrieve a row with a datetime value, I get a tuple like: >>> myCursor.execute( 'SELECT * FROM table' ) >>> for row in myCursor.fetchall(): print row (, 'value2', 'value3', 'value4', 100) I would lik

Re: [Tutor] Data storage, SQL?

2005-02-11 Thread Bill Kranec
I also recommend learning SQL. It is not very hard to learn, and sometimes it may be advantageous to do data manipulation directly in the database, rather than with Python. As far as databases go, I would recommend Firebird, as I have found that it has a good number of features, is free, and

[Tutor] carriage return on windows

2005-01-29 Thread Bill Kranec
Hello, I'm trying to have a loop in a program print a message so I know it's status. Right now I'm using print "Percent completed:" + str(percent) + "\r" Which should send me back to the beginning of the line and overwrite it with a new line. But instead I get: Percent completed: 50 Percent c

Re: [Tutor] Advise...

2005-01-26 Thread Bill Kranec
There has been alot of talk on this list about using list comprehensions lately, and this could be one of those useful places. While I don't have time to experiment with real code, I would suggest changing your function to look like: steps = [ min_x + i*delta_x for i in range(steps) ] totalare

[Tutor] flattening a list

2005-01-11 Thread Bill Kranec
Hello, I have a list of lists, for example [ [1,2] , [3,4] ], and I would like to pass all the elements of that list as arguments to a function (for example the intersection of all list elements). Is there a command in regular Python to do this? I would like to avoid the hassle and speed hit

Re: [Tutor] simple list query

2005-01-02 Thread Bill Kranec
You might want to try: x in list this will return true if, for example, list = [x,y,z,w], false if list = [y,y,y,y] Bill Dave S wrote: OK simple query, I have a list consisting of about 250 items, I need to know if a particular item is in the list. I know this is better suited to a dictionary

[Tutor] listing all combinations of elements of a list

2004-12-12 Thread Bill Kranec
Is there a module containing a function for listing the unique k-element subsets of an n-item list? I have written some code (right now I only need it for 2 element subsets): def combination(items) list = [] for i in range(0,len(items)): for j in range(0,len(items)): if j >