Hi guys!
Thank you all for the brainstorming. As much as i love to follow all your
tips but sorry I got lost in the sea of discussion :-) Therefore i thought i
start to roll out my own and i hope you guys can chime in.
The print lines in my code are just for debugging. Of course they can be
omitt
Antonio de la Fuente wrote:
* Dave Angel [2009-11-17 16:30:43 -0500]:
for line in fileIn:
if line.isspace():
Antonio de la Fuente wrote:
* bob gailer [2009-11-17 15:26:20 -0500]:
Date: Tue, 17 Nov 2009 15:26:20 -0500
From: bob gailer
To: Antonio de la Fuente
CC: Python Tutor mailing list
Subject: Re: [Tutor] Introduction - log exercise
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Message
Alan Gauld wrote:
"Antonio de la Fuente" wrote
> if not line.isspace() and not line == 'foo':
> fileOut.write(line)
But then, the new log file will have all the blocks, even the ones that
had 'foo' on it, even if the foo lines weren't there anymore. No? or
is there anything that I don't g
* Dave Angel [2009-11-17 16:30:43 -0500]:
> Date: Tue, 17 Nov 2009 16:30:43 -0500
> From: Dave Angel
> To: Antonio de la Fuente
> CC: Python Tutor mailing list
> Subject: Re: [Tutor] Introduction - log exercise
> User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
> Message-ID: <4b031603.4000.
* bob gailer [2009-11-17 15:26:20 -0500]:
> Date: Tue, 17 Nov 2009 15:26:20 -0500
> From: bob gailer
> To: Antonio de la Fuente
> CC: Python Tutor mailing list
> Subject: Re: [Tutor] Introduction - log exercise
> User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
> Message-ID: <4b0306ec.8000.
"Antonio de la Fuente" wrote
> if not line.isspace() and not line == 'foo':
> fileOut.write(line)
But then, the new log file will have all the blocks, even the ones that
had 'foo' on it, even if the foo lines weren't there anymore. No? or
is there anything that I don't get?
I think the
On Tue, Nov 17, 2009 at 1:37 PM, wrote:
>> Alan Gauld wrote:
>>>
>>> wrote
>>> If you do you can call it explicitly, but if you do not then you need to
>>> find a way of getting the OS to tell you, or to leave it to the OS.
>
> I'm interested in nthis for the sake of generalizing (which is bett
Dammit. Meant to send this over the list. Sorry, Alan.
On Di, 2009-11-17 at 21:33 +, Alan Gauld wrote:
> Unices, like Linux have file association tables - but these
> are often associated with the desktop environment - KDE, Gnome etc.
> Finally for text files you should check the EDITOR and V
wrote
If you do you can call it explicitly, but if you do not then you
need to find a way of getting the OS to tell you, or to leave it to
the OS.
I'm interested in nthis for the sake of generalizing (which is
better). How can I get the OS to tell me which program to use.
alternatively,
On Mon, Nov 16, 2009 at 3:54 PM, Modulok wrote:
> List,
>
> A general question:
>
> How many of you guys use unit testing as a development model, or at
> all for that matter?
>
> I just starting messing around with it and it seems painfully slow to
> have to write a test for everything you do. Th
Antonio de la Fuente wrote:
Hi everybody,
This is my first post here. I have started learning python and I am new to
programing, just some bash scripting, no much.
Thank you for the kind support and help that you provide in this list.
This is my problem: I've got a log file that is filling up
On Tue, Nov 17, 2009 at 1:57 PM, wrote:
> A rather general question, I'm afraid. I have found myself writing some
> python code to handle some CSV data, using the csv. DictReader that generates
> a dict for each row with the key as the column heading and the value in the
> file as the item. M
* Nick Stinemates [2009-11-17 13:30:51 -0500]:
> Date: Tue, 17 Nov 2009 13:30:51 -0500
> From: Nick Stinemates
> To: Antonio de la Fuente
> Cc: Python Tutor mailing list
> Subject: Re: [Tutor] Introduction - log exercise
> Mail-Followup-To: Antonio de la Fuente ,
> Python Tutor mailing l
On Tue, Nov 17, 2009 at 2:23 PM, Antonio de la Fuente wrote:
> But then, the new log file will have all the blocks, even the ones that
> had 'foo' on it, even if the foo lines weren't there anymore. No? or
> is there anything that I don't get?
>
Ah yes, I forgot about that part.
So you should pr
Antonio de la Fuente wrote:
Hi everybody,
This is my first post here. I have started learning python and I am new to
programing, just some bash scripting, no much.
Thank you for the kind support and help that you provide in this list.
This is my problem: I've got a log file that is filling up
* Wayne Werner [2009-11-17 11:41:25 -0600]:
> Date: Tue, 17 Nov 2009 11:41:25 -0600
> From: Wayne Werner
> To: Antonio de la Fuente
> Cc: Python Tutor mailing list
> Subject: Re: [Tutor] Introduction - log exercise
> Message-ID: <333efb450911170941g709e7ea3l4b4316044be09...@mail.gmail.com>
>
Alan Gauld wrote:
wrote
Yes. My program knows. A database column stores the complete file
name (including extension), and I can be certain the applications
will be available to run the file.
You still haven't answered the question.
We have established that
a) The OS knows what program i
Dear Tutors,
A rather general question, I'm afraid. I have found myself writing some python
code to handle some CSV data, using the csv. DictReader that generates a dict
for each row with the key as the column heading and the value in the file as
the item. Most operations involve code of the fo
> I will read lines from file, with the 'for loop', and then I will check them
> for
> 'foo' matches with a 'while loop', if matches I (somehow) re-initialise the
> list, and if there is no matches for foo, I will append line to the list.
> When I
> get to a blank line (end of block), write myLis
On Tue, Nov 17, 2009 at 10:58 AM, Antonio de la Fuente wrote:
> Hi everybody,
>
> This is my first post here. I have started learning python and I am new to
> programing, just some bash scripting, no much.
> Thank you for the kind support and help that you provide in this list.
>
You're welcome!
Hi everybody,
This is my first post here. I have started learning python and I am new to
programing, just some bash scripting, no much.
Thank you for the kind support and help that you provide in this list.
This is my problem: I've got a log file that is filling up very quickly, this
log file is
Stephen Nelson-Smith wrote:
A friend of mine mentioned what he called the 'pythonic' idiom of:
print a or b
Isn't this a 'clever' kind or ternary - an if / else kind of thing?
I would say it's perfectly idiomatic in Python, but
not as a ternary. If you want a ternary use the
(relatively) rece
A friend of mine mentioned what he called the 'pythonic' idiom of:
print a or b
Isn't this a 'clever' kind or ternary - an if / else kind of thing?
I don't warm to it... should I?
S.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change sub
rick wrote:
Perhaps the wrong list, but I'll ask anyway. So I'm in the middle of
starting, yet again, to learn some programming. I have 2.6.4 and 3.1
installed on the desktop (Ubuntu 9.10), 2.6.4 installed on the netbook
(UNR 9.10).
I was thinking to be ultra portable, I'd put python on t
Le Tue, 17 Nov 2009 09:56:23 +0100,
spir stated:
> > b) You can go back and run the tests again 6 months later,
> > c) if you have to add a new test its easy to make sure you don't break
> > what used to work (regression testing).
>
> Do not understand this point. Would you be kind and exp
Le Tue, 17 Nov 2009 08:01:32 -,
"Alan Gauld" stated:
Hello, Alan,
> The real benefits of unit tests are:
> a) You test stuff as you write it so you know where the bug must lie
Yes! (tried to say the same much clearly ;-)
> b) You can go back and run the tests again 6 months later,
> c) if
wrote in message
I'm running a test to find what the experimental average of a d20 is, and
came across a strange bug in my code.
import random
list1 = []
def p():
d = 0
for number in range(1,1000):
t = random.randrange(1,19)
list1.append(t)
for value in list1:
d+
"MARCUS NG" wrote
what is the best way to look into the allFiles directory, and only search
the folder for the 2 files myTest1.0.zip and myTest2.0.zip to extract out
only the version numbers 1.0 and 2.0.
You probably want to use the glob.glob() function to search using
a pattern like myTest*
Le Mon, 16 Nov 2009 13:54:26 -0700,
Modulok stated:
> List,
>
> A general question:
>
> How many of you guys use unit testing as a development model, or at
> all for that matter?
I do. Systematically. Has become a reflex.
I would rather ask the opposite question: how do know a part of your co
"rick" wrote
Now I'm back to the problem that a Windows newbie would have, the
scripts complete before I can see what happened! I can get right to the
interactive mode, or I can run a script, but not sure where I'd find the
terminal.
Have a look at the "Note for Windows Users" in the Topic
"Stephen Nelson-Smith" wrote
As a discipline - work out what we want to test, write the test, watch
it fail, make it pass - I find this a very productive way to think and
work.
Warning:
It can be seductively addictive and lead to very bad code structure.
You start focussing on just passing
"Modulok" wrote
How many of you guys use unit testing as a development model, or at
all for that matter?
Personally I use unit testing for anything that I'm getting paid for
Occasionally I use it for something I'm doing for myself, but only
if its quite big - several modules and over say
33 matches
Mail list logo