Re: Dictionary help

2007-11-01 Thread wes weston
Steve wrote: > I'm currently working on a little database type program is which I'm > using a dictionary to store the information. The key is a component a and > the definition is a list of parts that make up the component. My problem > is I need to list out several components, but not all, and

Re: python under earthlink hosting?

2006-08-01 Thread wes weston
No, but before I signed up with them I asked if it was available and they said yes. wes mbstevens wrote: > I keep chatting with the tech support people at Earthlink, asking where > the location of the Python interpreter is. They don't seem to know where > it is. They don't know if Python is run

Re: Parsing HTML--looking for info/comparison of HTMLParser vs. htmllib modules.

2006-07-07 Thread wes weston
from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) self.TokenList = [] def handle_data( self,data): data = data.strip() if data and len(data) > 0: self.TokenList.append(data)

Re: Class probkem - getting msg that self not defined

2006-05-22 Thread wes weston
Andrew Robert wrote: > wes weston wrote: >> Andrew Robert wrote: >>> Hi Everyone, >>> >>> I am having a problem with a class and hope you can help. >>> >>> When I try to use the class listed below, I get the statement that self >>> is

Re: Class probkem - getting msg that self not defined

2006-05-22 Thread wes weston
Andrew Robert wrote: > Hi Everyone, > > I am having a problem with a class and hope you can help. > > When I try to use the class listed below, I get the statement that self > is not defined. > > test=TriggerMessage(data) self is not known here; only inside the class. > var = tes

Re: Basic coin flipper program - logical error help

2006-02-21 Thread wes weston
DannyB wrote: > I'm just learning Python. I've created a simple coin flipper program - > here is the code: > > [source] > #Coin flipper > import random > > heads = 0 > tails = 0 > counter = 0 > > coin = random.randrange(2) > > while (counter < 100): > if (coin == 0): > heads += 1 >

Re: Walking through a mysql db

2005-06-04 Thread wes weston
Jeff Elkins wrote: > I'm writing a small wxpython app to display and update a dataset. So far, I > get the first record for display: > > try: > cursor = conn.cursor () > cursor.execute ("SELECT * FROM dataset") > item = cursor.fetchone () > > Now, how do I step through the dat

Re: Rotating arbitrary sets of elements within a list

2005-04-08 Thread wes weston
[EMAIL PROTECTED] wrote: I'm trying to come up with a good algorithm to do the following: Given a list 'A' to be operated on, and a list 'I' of indices into 'A', rotate the i'th elements of 'A' left or right by one position. Here's are some examples: A = [a, b, c, d, e, f] I = [0, 3, 4] rotate(A, I

Re: Rotating arbitrary sets of elements within a list

2005-04-08 Thread wes weston
[EMAIL PROTECTED] wrote: I'm trying to come up with a good algorithm to do the following: Given a list 'A' to be operated on, and a list 'I' of indices into 'A', rotate the i'th elements of 'A' left or right by one position. Here's are some examples: A = [a, b, c, d, e, f] I = [0, 3, 4] rotate(A, I

Re: MySQL problem

2005-03-18 Thread wes weston
Dennis Lee Bieber wrote: On Thu, 17 Mar 2005 16:45:57 GMT, wes weston <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: str = "INSERT INTO produkt1 (MyNumber) VALUES(%d)" % (MyNumber) cursor.execute(str) Think you meant "MyValue" for the second item

Re: Simple account program

2005-03-17 Thread wes weston
Igorati wrote: Hello all, I am still needing some help on this code, I have gone a bit further on it. Thank you for the help. I am trying to understand how to make the file searchable and how I am to make the deposit and withdrawl interact with the transaction class. I need to just search the file

Re: MySQL problem

2005-03-17 Thread wes weston
Lad wrote: I have the following program( only insert a record) import MySQLdb conn = MySQLdb.connect (host = "localhost",user = "", passwd = "",db="dilynamobily") cursor = conn.cursor () cursor.execute("""CREATE TABLE produkt1 ( id int(10) unsigned NOT NULL auto_increment, MyNu

Re: What's the cost of using hundreds of threads?

2005-03-01 Thread wes weston
Przemysław Różycki wrote: Hello, I have written some code, which creates many threads for each connection ('main connection'). The purpose of this code is to balance the load between several connections ('pipes'). The number of spawned threads depends on how many pipes I create (= 2*n+2, where n

Re: String Replace Problem...

2005-02-28 Thread wes weston
[EMAIL PROTECTED] wrote: Hello NG, probably this is a basic question, but I'm going crazy... I am unable to find an answer. Suppose that I have a file (that I called "Errors.txt") which contains these lines: MULTIPLY 'PERMX' @PERMX1 1 34 1 20 1 6 / 'PERMX' @PERMX2 1 34 21 41

Re: namespace collisions

2005-02-17 Thread wes weston
Will McGugan wrote: Hi, I'm accumulating a number of small functions, which I have sensibly put in a single file called 'util.py'. But it occurs to me that with such a generic name it could cause problems with other modules not written by myself. Whats the best way of handling this? If I put it

Re: broke tkinter

2005-02-08 Thread wes weston
Philippe C. Martin wrote: Hi, I decided to clean my system and rebuild python from scratch. I downloaded tk8.4.9, tcl8.4.9 and Python2-4.tar.bz2. I installed tcl then tk using './configure --prefix=/usr' tkcvs is now working OK trying to compile python (configure = './configure --prefix=/usr', I ge

Re: How do you do arrays

2005-02-01 Thread wes weston
Thomas, If you were allowed to do what you're doing, the list first element would be getting skipped as "index" is always > 0. The thing is, you don't want the "index" var at all for adding to the list; just do jMatrix.append(k). You can iterate over the list with for x in jMatrix: print x

Re: How do you do arrays

2005-02-01 Thread wes weston
Thomas Bunce wrote: I am new at Pyton and I am learning from book not classes so please forgive my being slow The below does not work I get an Error of File "Matrix[index] = k NameError: name 'iMatrix' is not defined" while index < majorlop1: index = index + 1 k = random.choice(listvalues

Re: Where are list methods documented?

2005-02-01 Thread wes weston
Grant Edwards wrote: I'm trying to figure out how to sort a list, and I've run into a problem that that I have tripped over constantly for years: where are the methods of basic types documented? The only thing I can find on a list's sort() method is in the tutorial where it states: sort()

Re: Where can I find sample "beginner" programs to study?

2005-01-28 Thread wes weston
Todd_Calhoun wrote: I'm trying to learn Python (and programming), and I'm wondering if there are any places where I can find small, simple programs to study. Thanks. Todd, Have you been here: http://www.python.org/doc/ and tried the tutorial or beginners guide? The tutorial has all the piec

Re: A completely silly question

2004-12-17 Thread wes weston
Amir Dekel wrote: Harlin Seritt wrote: Simple, Simple, Simple: Var = raw_input("Some prompting text here: ") Frans Englich wrote: > > See sys.stdin > What I need from the program is to wait for a single character input, something like while(getchar()) in C. All those Python modules don't make

Re: Find index of item in list

2004-12-07 Thread wes weston
Sean Berry wrote: Given myList = ['cat', 'dog', 'mouse' ... 'bear'] what is the easiest way to find out what index 'dog' is at? Sean, >>> myList = ['cat', 'dog', 'mouse','bear'] >>> myList.index('dog') 1 >>> wes -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on sorting

2004-11-29 Thread wes weston
Lad wrote: Hi, I have a file of records of 4 fields each. Each field is separated by a semicolon. That is Filed1;Ffield2;Field3;Field4 But there may be also empty records such as (only semicolons). For sorting I used # lines = file('Config.txt').readlines()# a file I want to so