[Tutor] updating a Csv file

2010-10-20 Thread Albert-Jan Roskam
Hi all, How can I update a csv file? I've written the code below, but it does not work ("Error: line contains NULL byte"). I've never tried opening a file in read and write mode (r+) at the same time before, so I suspect that this is the culprit. Should I instead just open one file, write to

Re: [Tutor] updating a Csv file

2010-10-20 Thread Steven D'Aprano
On Wed, 20 Oct 2010 08:05:06 pm Albert-Jan Roskam wrote: > Hi all, > > > > How can I update a csv file? I've written the code below, but it does > not work ("Error: line contains NULL byte"). Please copy and paste (DO NOT re-type, summarize, paraphrase or repeat from memory) the ACTUAL exception,

Re: [Tutor] Problem with python

2010-10-20 Thread Steven D'Aprano
On Wed, 20 Oct 2010 08:02:43 am Matthew Nunes wrote: > I cannot understand the how it claimed the code executed, and > logically it makes no sense to me. Please explain it to me, as I > have spent hours trying to get my head around it, as the book(in my > opinion) did not explain it well. Here it

Re: [Tutor] updating a Csv file

2010-10-20 Thread Dave Angel
On 2:59 PM, Albert-Jan Roskam wrote: Hi all, How can I update a csv file? I've written the code below, but it does not work ("Error: line contains NULL byte"). I've never tried opening a file in read and write mode (r+) at the same time before, so I suspect that this is the culprit. Should I

[Tutor] get_browser() in python

2010-10-20 Thread Norman Khine
is there an equivalent module like the php's get_browser() http://php.net/manual/en/function.get-browser.php function? thanks -- ˙uʍop ǝpısdn p,uɹnʇ pןɹoʍ ǝɥʇ ǝǝs noʎ 'ʇuǝɯɐן sǝɯıʇ ǝɥʇ puɐ 'ʇuǝʇuoɔ ǝq s,ʇǝן ʇǝʎ %>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-83)%26) for c in ",ad

Re: [Tutor] updating a Csv file

2010-10-20 Thread Albert-Jan Roskam
Hi Steven and Dave, Thanks for replying to me. Steven, I pasted the traceback below, along with some version info. I'm using Windows XP. I used the very same code as the one I posted before, including the string.letters bit. Btw, thanks for the little 'list' tip. Dave, what you say makes sense

Re: [Tutor] get_browser() in python

2010-10-20 Thread Norman Khine
thanks On Wed, Oct 20, 2010 at 4:12 PM, Greg wrote: > Forgot to send to list. > > On Wed, Oct 20, 2010 at 10:12 AM, Greg wrote: >> On Wed, Oct 20, 2010 at 9:03 AM, Norman Khine wrote: >>> is there an equivalent module like the php's get_browser() >>> http://php.net/manual/en/function.get-browse

[Tutor] Writing Scripts.

2010-10-20 Thread Autumn Cutter
I just started learning Python last night and I'm a little stuck on how to write a Python script. I'm using Python 2.5.0 on a Mac OS X 10.6.4. I've tried using programs like Idle, Applescript and Textmate but I'm still unable to write a script and run it successfully. I'm wondering if I'm using

Re: [Tutor] Writing Scripts.

2010-10-20 Thread शंतनू
Save the file. e.g. my_test_prog.py. Open 'terminal'. Run following command 'python my_test_prog.py' On my 10.6.4 version of Mac OSX, I get following version of python. === $ /usr/bin/python Python 2.6.1 (r261:67515, Dec 17 2009, 00:59:15) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin === On 2

Re: [Tutor] Writing Scripts.

2010-10-20 Thread Alan Gauld
"Autumn Cutter" wrote I just started learning Python last night and I'm a little stuck on how to write a Python script. I'm using Python 2.5.0 on a Mac OS X 10.6.4. To create the program you use any standard text editor - although one that supports programming will be better. So you can us

Re: [Tutor] updating a Csv file

2010-10-20 Thread Alan Gauld
"Albert-Jan Roskam" wrote I tried updating the old values with new values of exactly the same length (10 characters), but that didn't work either newLine = [ch for ch in string.letters[0:9]]) Error: line contains NULL byte Id,NaamInstelling,Naam3,Straat,HuisNr,Postcode,Plaats,dummy Th

[Tutor] csv DictReader/Writer question

2010-10-20 Thread Ara Kooser
Hello all, I have a csv file (from a previous code output). It looks like this: Species2, Protein ID, E_value, Length, Hit From, Hit to, Protein ID2, Locus Tag, Start/Stop, Species Streptomyces sp. AA4, ZP_05482482, 2.82936001e-140, 5256, 1824, 2249\n, ZP_05482482, StAA4_01010003048

Re: [Tutor] Problem with python

2010-10-20 Thread Dave Kuhlman
On Wed, Oct 20, 2010 at 03:02:43AM +0600, Matthew Nunes wrote: > >To whom it may concern, > > Hi, I've just started learning how >to program in python using Allan B. Downy's book "How to think like a >computer scientist" and it explained something

[Tutor] Stopping a webservice

2010-10-20 Thread Timo
Hello, I have written a Python script that constantly checks for incoming connections. It is a class and runs a while loop until shutdown is set to True. Something like: class Connection(object): def __init__(self): self.shutdown = False def mainloop(self): while not self

Re: [Tutor] Stopping a webservice

2010-10-20 Thread Alan Gauld
"Timo" wrote I have written a GUI and when I click the Quit-button, I do "connection.shutdown = True", which works great. The plans are to run this on my webserver. I created a webpage with a start and stop button, the starting works great. But how could I remember this class to call "class

[Tutor] LCM

2010-10-20 Thread Jacob Bender
Hello all, I was wondering if you could please help me with an issue I'm having with my program. I'm not fond of LCM(Least Common Multiples), and I decided to make a program that deals with them. Here's the code: thing = raw_input("What is the first number?\n\n") thing2 = raw_input("What is

Re: [Tutor] LCM

2010-10-20 Thread christopher . henk
benderjaco...@gmail.com wrote on 10/20/2010 07:30:32 PM: > > thing = raw_input("What is the first number?\n\n") > > thing2 = raw_input("What is the second number?\n\n") > > int(thing) > int(thing2) > The two lines above do the calculation of turning your input strings into int's but d

Re: [Tutor] LCM

2010-10-20 Thread Shashwat Anand
On Thu, Oct 21, 2010 at 5:00 AM, Jacob Bender wrote: > Hello all, > > I was wondering if you could please help me with an issue I'm having with > my program. I'm not fond of LCM(Least Common Multiples), and I decided to > make a program that deals with them. Here's the code: > > thing = raw_input

[Tutor] Importing photo-python

2010-10-20 Thread steven nickerson
I would like to somehow import and output a photo to the screen via tkinter window not very described sorry, I just would like to know how i can get photos into python ex. .gif (In photo format not video), .jpg ect.

[Tutor] deepak mishra has invited you to open a Google mail account

2010-10-20 Thread deepak mishra
I've been using Gmail and thought you might like to try it out. Here's an invitation to create an account. You're Invited to Gmail! deepak mishra has invited you to open a Gmail account. Gmail is Google's free email service, built on the idea that email can be intuitive, efficient, and fun. G

Re: [Tutor] Writing Scripts.

2010-10-20 Thread Connor Neblett
Alternately, I believe that MacPython comes packaged with an application called "Python Launher". If you right click a python file (.py) once this is app is installed, you can select "Open With -> Python Launcher" This method is more for people that are uncomfortable with the command line (Termi