Re: [Tutor] processing a text file w/ OO?

2006-01-22 Thread Pujo Aji
you can use regex if you want.It gives you power to do text processing.OO will give you benefit because your program becomes clearer while it  is developedCheers,pujo On 1/23/06, Michael <[EMAIL PROTECTED]> wrote: Hi.I'm processing a tab-delimited text file where I read in a file,perform a bunch of

[Tutor] processing a text file w/ OO?

2006-01-22 Thread Michael
Hi. I'm processing a tab-delimited text file where I read in a file, perform a bunch of operations on the items, and then write them out again to a fixed-width text file. I've been doing this with a very functional approach: - loop over lines - read line into dictionary - process dictionary

Re: [Tutor] Totorial announcement

2006-01-22 Thread Alan Gauld
> Excellent guide. I bookmarked it :-) because I plan to use it alot. Glad you like it, as you'll see I have a few more topics planned yet but each topic takes from 3-12 weeks to write... > Oh, how much work (in hours) did it take it to translate your website? To translate, I don't know, some

Re: [Tutor] python-based system programming and admin?

2006-01-22 Thread Neal McBurnett
On Sun, Jan 22, 2006 at 06:19:55PM -0600, Hugo González Monteverde wrote: > I used to do perl on linux until I found Python, I find it very easy to > run quick scripts and system stuff without having to learn BASH, sed, > awk, etc separately, taht way I can do regexp, listings, recursion on > di

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Monday, 23 January 2006 at 10:59:24 +1100, Shuying Wang wrote: > I'm guessing when you did that, you got something like an IndexError. > That's because you didn't check the length of "a" from raw_input and > accessed a nonexistent array element (a string is an array of > characters). So if you c

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Sunday, 22 January 2006 at 18:11:09 -0600, Hugo González Monteverde wrote: > Hi Vincent, > > > the program works with any input except when you just hit the enter key. > > > To be able to understand why is the crash, take a look at what the > interpreter tells you: > > > File "untitled.p

Re: [Tutor] python-based system programming and admin?

2006-01-22 Thread Hugo González Monteverde
MMM strange needs... I'm thinking that perhaps allowing him to run idle and exporting X display to the Mac could be an option? I used to do perl on linux until I found Python, I find it very easy to run quick scripts and system stuff without having to learn BASH, sed, awk, etc separately, taht

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Sunday, 22 January 2006 at 16:07:06 -0800, bob wrote: > At 03:46 PM 1/22/2006, Vincent Zee wrote: > >Why will this little program crash when you enter the enter key? > > Thank you for including the "traceback" message in your 2nd post. > > Index error means you tried to reference an element of

Re: [Tutor] I'm puzzled

2006-01-22 Thread Hugo González Monteverde
Hi Vincent, > the program works with any input except when you just hit the enter key. To be able to understand why is the crash, take a look at what the interpreter tells you: > File "untitled.py", line 12, in ? >elif a[0] == '-' and a[1:].isdigit(): > IndexError: string index out of

Re: [Tutor] I'm puzzled

2006-01-22 Thread bob
At 03:46 PM 1/22/2006, Vincent Zee wrote: >Why will this little program crash when you enter the enter key? Thank you for including the "traceback" message in your 2nd post. Index error means you tried to reference an element of a sequence that is not there. a is the empty string when you just h

Re: [Tutor] I'm puzzled

2006-01-22 Thread Shuying Wang
I'm guessing when you did that, you got something like an IndexError. That's because you didn't check the length of "a" from raw_input and accessed a nonexistent array element (a string is an array of characters). So if you changed the line: elif a[0] == '-' and a[1:].isdigit(): to : elif len(a) >

Re: [Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
On Sunday, 22 January 2006 at 15:54:06 -0800, Danny Yoo wrote: > > > Why will this little program crash when you enter the enter key? > > [program cut] > > Hi Vincent, > > What do you mean by "crash"? Do you get an error message? If so, can you > show us? > > > It will also help to think to

Re: [Tutor] I'm puzzled

2006-01-22 Thread Danny Yoo
> Why will this little program crash when you enter the enter key? [program cut] Hi Vincent, What do you mean by "crash"? Do you get an error message? If so, can you show us? It will also help to think to try playing the situation out without preconceptions. In the beginning of the loop, a

[Tutor] I'm puzzled

2006-01-22 Thread Vincent Zee
Hi all, I'm puzzled (:-)) Why will this little program crash when you enter the enter key? while True: a = raw_input('number? ') if a.isdigit(): print 'isdigit' elif a[0] == '-' and a[1:].isdigit(): print '- + isdigit' elif a == 'q': break else:

Re: [Tutor] webcam secrets?

2006-01-22 Thread Hugo González Monteverde
Hi Johnny, As someone already said, it could be possible to do that without going into any code, but assuming you want to do it by means of Python... I assume you're using Windows, are you trying to control another application (the one that came with your webcam)? are you trying to write a pro

[Tutor] Framework recommendations for e-commerce

2006-01-22 Thread Kenneth Kalmer
Greetings list This is my first post to the list, please excuse me if I mess up... OK, I'm new to Python, but not new to programming. I have years of PHP behind me, and some C# & Java (to name the "bigger" names)... I'm asking this question here because I'm new, and it must have been discussed e

Re: [Tutor] Totorial announcement

2006-01-22 Thread Rinzwind
Excellent guide. I bookmarked it :-) because I plan to use it alot.Oh, how much work (in hours) did it take it to translate your website? WimOn 1/22/06, Alan Gauld <[EMAIL PROTECTED]> wrote: I've just uploaded the completed tutoroial topic on OS access.It covers most of the common questions asked

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-22 Thread ZIYAD A. M. AL-BATLY
On Sun, 2006-01-22 at 12:43 +, John Joseph wrote: > Hi Hi John... Most of your problems in your code seems to be caused by a single mistake. Compare the following two strings and you should figure out what's wrong by yourself: email_id = '[EMAIL PROTECTED]' wrong_s

[Tutor] Totorial announcement

2006-01-22 Thread Alan Gauld
I've just uploaded the completed tutoroial topic on OS access. It covers most of the common questions asked on this list about determining file access, launching programs (including use of the new subprocess module), accessing environment variables etc. It also has a short intro to bitmask manip

Re: [Tutor] webcam secrets?

2006-01-22 Thread Rinzwind
That (mosttimes) is a setting in your webcamsoftware and doesn't require coding.WimOn 1/22/06, johnny` walker < [EMAIL PROTECTED]> wrote:i was wondering if there was a way to automatically take a picture from my webcam every oh say 5 minutes?   is there anyway of doing this (im very new to progr

[Tutor] [webbrowser] some help on an error running mozilla firefox

2006-01-22 Thread Rinzwind
Why does this: >>> import webbrowser >>> webbrowser.open('http://www.google.com")give me this: run-mozilla.sh: Cannot execute /opt/firefox/mozilla-firefox-bin. Is this bacause 'webbrowser' does not know about the identification of 1.5?(I do not want to do it like this: >>> import os

[Tutor] webcam secrets?

2006-01-22 Thread johnny` walker
i was wondering if there was a way to automatically take a picture from my webcam every oh say 5 minutes?   is there anyway of doing this (im very new to programming languages.)___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listi

Re: [Tutor] Starbucks does not use two-phase commit

2006-01-22 Thread Todd Maynard
Well Danny, now I know how I am gonna spend my Sunday Thanks for the great explanation and the resources. Of course do you think I could manage to get the code to break - of course not Usually I have the opposite problem. Anyways I think that your explanation makes perfect sense. My

[Tutor] Searching for email id in MySQL giving wrong results

2006-01-22 Thread John Joseph
Hi Thanks to Allan,Danny,Pujo I did my simple python script for MySQL , the scripts add the data , and search for the data and display I have problem in searching email id ,ie If search for the [EMAIL PROTECTED] , I will not get any result , Guidance and advice needed

Re: [Tutor] Starbucks does not use two-phase commit

2006-01-22 Thread Danny Yoo
On Sat, 21 Jan 2006, Todd Maynard wrote: > I want to thank you for ruining my plans for a relaxing Saturday > morning. As a thread newbie I killed several hours playing around with > your code. Hi Todd, Sorry about that. I hope you were relaxing in a cafe while playing with the code. > One