On Mon, 2009-02-16 at 09:38 -0500, bob gailer wrote:
> Lie Ryan wrote:
> > On Sun, 2009-02-15 at 21:29 +0100, tutor-requ...@python.org wrote:
> >
> >
> >> Do you know about sequence unpacking? In an assignment statement, when
> >> the right side is a sequence, the left side can be a list of vari
Lie Ryan wrote:
On Sun, 2009-02-15 at 21:29 +0100, tutor-requ...@python.org wrote:
Do you know about sequence unpacking? In an assignment statement, when
the right side is a sequence, the left side can be a list of variables
of the same length as the sequence. Then each sequence element is
a
On Sun, 2009-02-15 at 21:29 +0100, tutor-requ...@python.org wrote:
> Do you know about sequence unpacking? In an assignment statement, when
> the right side is a sequence, the left side can be a list of variables
> of the same length as the sequence. Then each sequence element is
> assigned to one
"Wayne Watson" wrote
If you ever get a chance to try the Moz experiment above,
I'd be interested in your reaction.
I no longer have Mozilla loaded - far too resource hungry.
I use IE, Firefox and Chrome plus occasionally Safari on my Mac.
All of them move bookmarks using simple drag n drop
Title: Signature.html
Thanks. Got it. It finally dawned on me in the midst of responding to
Kent.
If you ever get a chance to try the Moz experiment above, I'd be
interested in your reaction. I see it as my 11:47 post.
Alan Gauld wrote:
"John
Fouhy" wrote
for index, item in [9,8,7,6]
"John Fouhy" wrote
for index, item in [9,8,7,6]:
print index, item
0 9
1 8
2 7
3 6
You mean:
for index, item in enumerate([9,8,7,6]):
print index, item
Oops, yes, thanks for catching that. It was fairly
fundamental to the discussion!
Alan G
___
2009/2/16 Alan Gauld :
> for index, item in [9,8,7,6]:
> print index, item
>
>
> 0 9
> 1 8
> 2 7
> 3 6
You mean:
for index, item in enumerate([9,8,7,6]):
print index, item
:-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/
"Wayne Watson" wrote
I'm still looking for an explanation of "
for (line_cnt, each_line) in enumerate(input_file)".
Why the tuple?
Apparently, line_count gets a line number, and each_line gets the
string
OK, Back up from the specific problem to the more general case.
enumerate does not retu
Title: Signature.html
I don't think so. Not as a Python concept, but it looks sensible in
your example. However, why would enumerate produce a line number? How
would one know that it does? Ah, I see. enumerate produces a tuple
which has the index and a list. It appears the only place this can b
On Sun, Feb 15, 2009 at 2:47 PM, Wayne Watson
wrote:
> I'm still looking for an explanation of "for (line_cnt, each_line) in
> enumerate(input_file)". Why the tuple? Apparently, line_count gets a line
> number, and each_line gets the string of text.
Do you know about sequence unpacking? In an ass
On Sun, Feb 15, 2009 at 1:54 PM, Alan Gauld wrote:
> Have you tried GoogleChrome yet? It might suit your style better.
> It looks at addresses you type and searches both your history and
> bookmarks for previous sites visited that might match.
Firefox 3 also does that. Very handy!
Kent
Title: Signature.html
I'm still looking for an explanation of "for (line_cnt, each_line)
in enumerate(input_file)". Why the tuple? Apparently, line_count gets a
line number, and each_line gets the string of text.
Chrome. I've heard of it. Does it require an install, or is it one of
those odd b
"Wayne Watson" wrote
Thanks to your use of the word pillow it's not likely I will be
able to find the link to the Library Reference more easily,
strange as that may seem.
You are right it seems very strange!?
My browser's bookmark capabilities have put me in the
corner of disorganization,
Title: Signature.html
Yes, true enough about simplicity, but see my response to Alan.
Kent Johnson wrote:
On Sun, Feb 15, 2009 at 9:16 AM, Wayne Watson
wrote:
3. Where can I find out more about enumerate, as used here:
input_file=open('Initial.sen','r')
for (line_cnt, each_line
On Sun, Feb 15, 2009 at 9:16 AM, Wayne Watson
wrote:
> 3. Where can I find out more about enumerate, as used here:
>
> input_file=open('Initial.sen','r')
> for (line_cnt, each_line) in enumerate(input_file):
> print each_line
> input_file.close()
>
> I used this small program for other purpos
Title: Signature.html
Thanks. A file name! That's funny. Bitten by my early acquaintance a
few weeks ago with TkFileDialog, when I innocently stuck the method in
the function to come back to. Wrong method! I don't think I'll forget
next time. :-)
Yes, I agree with wanting to open and close the
"Wayne Watson" wrote
Three questions about askopenfilename and enumerate.
For askopenfilename:
1. Do I have to close the file before exiting from it?
2. How do I read each line of text in the file and quit when an eof
is reached?
This has nothing to do with askopenfilename!
Askopenfilenam
Title: Signature.html
A three questions about askopenfilename and enumerate.
For askopenfilename:
1. Do I have to close the file before exiting from it?
2. How do I read each line of text in the file and quit when an eof is
reached?
This certainly doesn't do it.
def OpenConfigFile(self):
18 matches
Mail list logo