[Tutor] Simple XML parsing

2005-12-15 Thread Tim Wilson
Hi everyone, I've got a little project that requires me to parse a simple XML file. The file comes from the browser history of Apple's Safari and includes the URL that was visited, the title of the Web page, the date and time it was last visited, and the total number of times it was visite

[Tutor] How do I fix this StopIteration error?

2005-12-15 Thread Nathan Pinno
I edited my code so that it looks like this: def save_rates(exch):    store = open("exch.txt","w")    for exch, rate in rates.items():    store.write(exch + '\n')    store.write(`rate` + '\n')    store.close()   def load_rates(exch):    import os    filename = 'exch.txt'    if o

Re: [Tutor] Python - SQL paradigm (Will I need a hammer to make it fit?)

2005-12-15 Thread bob
At 02:14 AM 12/14/2005, Liam Clarke wrote: >Hi all, > >Just contemplating. > >If in Python I were organising a data index along the lines of - > >j = { > >"k_word1" : ["rec1","rec2","rec3","rec4"], >... >"k_wordn" :["recX","rec4"] > >} > >and I was going to find records that matched by seeing what

Re: [Tutor] Guess my number game

2005-12-15 Thread Brian van den Broek
Pujo Aji said unto the world upon 2005-12-15 14:52: > Hi, > your guess still use random.randrange that's make computer doesn't care > about whether guess is low or higher than your number. > > This code should be like this: > Hope this help > > pujo > > On 12/15/05, William Mhlanga <[EMAIL PR

Re: [Tutor] serial data capture/event driven help

2005-12-15 Thread Alan Gauld
> event driven programming/asynchonis programming paradigm). Any advice > or linkage to some tutorial type articles for event driven design. You seem to have the basic concepts at least, but my tutorial does have a topic on event driven programming you can try. It may be too basic however. Al

Re: [Tutor] Guess my number game

2005-12-15 Thread Murtog
Try this code: #The Guess My Number Game # #The computer picks a random number between 1 and 50 #The player tries to guess it and the computer lets #the player know if the guess is too high, too low #or right on the money #If the player fails to guess the number after 5 tries #the game ends and th

Re: [Tutor] Guess my number game

2005-12-15 Thread Simon Gerber
Hi William, Just a word of warning, you should get used to using 'raw_input()' rather than 'input()' in your progams. Why? Because input() attempts to run whatever you type in as a Python program. If you want to know why that's a problem, try running your progam. When it asks you to "Enter the nu

Re: [Tutor] serial data capture/event driven help (fwd)

2005-12-15 Thread Danny Yoo
[keeping Tutor in CC] -- Forwarded message -- Date: Thu, 15 Dec 2005 13:40:11 -0600 From: Bobby Castleberry <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] serial data capture/event driven help Danny Yoo wrote: > There's a module for handling the seria

Re: [Tutor] Guess my number game

2005-12-15 Thread Pujo Aji
Hi, your guess still use random.randrange that's make computer doesn't care about whether guess is low or higher than your number.This code should be like this:    print "\t\t\tWelcome to \"Guess My Number\"!"     print "\nThink of a number between 1 and 50."    print "I will try to guess it in as

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
-Repost. considering that my previous email lost - hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit'

Re: [Tutor] writing list elements into a string

2005-12-15 Thread John Fouhy
On 16/12/05, ps python <[EMAIL PROTECTED]> wrote: > >>> a = ['apple','is','a','good','fruit'] > >>> ab ='' > >>> for m in a: > k = ''.join(m) > ab.join(k) You're almost there... >>> a = ['apple', 'is', 'a', 'good', 'fruit'] >>> ' '.join(a) 'apple is a good fruit' >>> '...'.join(a

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit' - getting this back into a string has drained my brain.

[Tutor] Guess my number game

2005-12-15 Thread William Mhlanga
I have been trying to write a guess my number game (using Michael Dawsons book), where the computer guesses the number that I thought of. Here is my code so far,#The Guess My Number Game ##The computer picks a random number between 1 and 50#The player tries to guess it and the computer lets#the pla

Re: [Tutor] serial data capture/event driven help

2005-12-15 Thread Danny Yoo
On Thu, 15 Dec 2005, Bobby Castleberry wrote: > I'm looking to capture weights coming off of several in-motion scales > through serial ports and dump them into a database. The database part > is easy but I've never worked with serial collection. Hi Bobby, There's a module for handling the ser

[Tutor] [Python-talk] ElementTree in Python 2.5!

2005-12-15 Thread Bill Freeman
Kent Johnson writes: > ... ElementTree My dear Watson!!! > ... ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tkinter help required

2005-12-15 Thread Vlad Popescu
Thanks a bunch, Michael. I am using Fedora Core 4 and have installed the tkinter package via yum. Everything is working great as far as I can tell. That really helped. Thanks again > On Wed, 14 Dec 2005 15:05:07 +0200 > Vlad Popescu <[EMAIL PROTECTED

[Tutor] serial data capture/event driven help

2005-12-15 Thread Bobby Castleberry
I'm looking to capture weights coming off of several in-motion scales through serial ports and dump them into a database. The database part is easy but I've never worked with serial collection. I would like to setup several data collection objects (one for each serial port) and as they reciev