Can I replace this for loop with a join?

2009-04-13 Thread WP
nt 'Press %i for %s' % (key, dict[key]) Press 1 for astring Press 2 for anotherstring but can I use a join instead? Thanks for any replies! - WP -- http://mail.python.org/mailman/listinfo/python-list

Why does way_1() obtain the correct list but way_2() gets an empty list?

2009-02-12 Thread WP
a library issue. To compensate somewhat I tried to show my entire test program and its output and make that test program as clear as possible. So if anyone knows why I get this behavior I would like to hear it and I will have learned something today too! :) - WP -- http://mail.python.org/mailman/listinfo/python-list

Re: Second python program: classes, sorting

2008-08-10 Thread WP
WP wrote: Solved the problem, see below... Hello, here are some new things I've problems with. I've made a program that opens and reads a text file. Each line in the file contains a name and a score. I'm assuming the file has the correct format. Each name-score pair is used t

Second python program: classes, sorting

2008-08-10 Thread WP
splitstuff[0], int(splitstuff[1]))) scores.sort() for a_score in scores: print a_score Test file contents: Michael 11 Hanna 1337 Lena 99 Output: in __cmp__ in __cmp__ Name = Michael, score = 11 Name = Hanna, score = 1337 Name = Lena, score = 99 What am I doing wrong here? - Eric (WP) -- http://mail.python.org/mailman/listinfo/python-list

Re: My very first python program, need help

2008-08-10 Thread WP
Wojtek Walczak wrote: [snip] Thanks for all your help. I've incorporated your suggestions and moved on to my next program. See new thread. :) - Eric (WP) -- http://mail.python.org/mailman/listinfo/python-list

My very first python program, need help

2008-08-10 Thread WP
put when run is: str = 123xx,22! p1 (for loop version) mylist after replace() and split() = ['123', '22', '1'] calculate_sum_1(str): 146 (regex version) mylist after calling split(): ['123', '', '', '22', '', '', '1'] calculate_sum_2(str): 146 Hope I made some sense and thanks for reading! - Eric (WP) -- http://mail.python.org/mailman/listinfo/python-list