Ben Keshet wrote:
...
I ended up using another method as someone suggested to me. I am still
not sure why the previous version got stuck on empty files, while this
one doesn't:
receptors = ['A' 'B']
*** Alarm bells *** Do you mean ['AB'], or do you mean ['A', 'B']?
...(more code one way) .
Wojtek Walczak wrote:
On Fri, 22 Aug 2008 10:42:13 -0400, Ben Keshet wrote:
Thanks. I tried to use 'for' instead of 'while' as both of you
suggested. It's running well as my previous version but breaks
completely instead of just skipping the empty file. I suspect the
reason is that this
Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
> John Machin a écrit :
> (snip)
> > A quick rule of thumb for Python: if your code looks ugly or
> > strained or awkward, it's probably also wrong.
>
> +1 QOTW
Merely a special case of the truism that "Your code is probably wrong
(regardless of an
On Fri, 22 Aug 2008 10:42:13 -0400, Ben Keshet wrote:
> Thanks. I tried to use 'for' instead of 'while' as both of you
> suggested. It's running well as my previous version but breaks
> completely instead of just skipping the empty file. I suspect the
> reason is that this part is inside anot
Thanks. I tried to use 'for' instead of 'while' as both of you
suggested. It's running well as my previous version but breaks
completely instead of just skipping the empty file. I suspect the
reason is that this part is inside another 'for' so it stops
everything. I just want to it to break
John Machin a écrit :
(snip)
A quick rule of thumb for Python: if your code looks ugly or strained
or awkward, it's probably also wrong.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 22, 9:01 am, Ben Keshet <[EMAIL PROTECTED]> wrote:
> Thanks for the reference. I tried it with a general example and got it
> to work - I used an index that counts up to a threshold that is set to
> break. It does not work though with my real code. I suspect this is
> because I cannot real
Ben Keshet wrote:
Thanks for the reference. I tried it with a general example and got it
to work - I used an index that counts up to a threshold that is set to
break. It does not work though with my real code. I suspect this is
because I cannot really read any lines from an empty file, so the
Thanks for the reference. I tried it with a general example and got it
to work - I used an index that counts up to a threshold that is set to
break. It does not work though with my real code. I suspect this is
because I cannot really read any lines from an empty file, so the code
gets stuck e
On Thu, 21 Aug 2008 18:01:25 -0400, Ben Keshet wrote:
> somehow. I use 'while 'word' not in line' to recognize words in the
> texts. Sometimes, the files are empty, so while doesn't find 'word' and
> runs forever. I have two questions:
> 1) how do I overcome this, and make the script skip the emp
Hi -
I am writing now my second script ever in python and need some help with
'while'. I am reading text from a set of files and manipulating the data
somehow. I use 'while 'word' not in line' to recognize words in the
texts. Sometimes, the files are empty, so while doesn't find 'word' and
ru
11 matches
Mail list logo