Sergei Steshenko |
10-28-2008 12:07 PM |
Quote:
Originally Posted by ghostdog74
(Post 3324156)
Code:
linenumbers = open("file_num").readlines()
linenumbers = [i.strip() for i in linenumbers]
for line in open("file_data"):
num,content = line.split(":")
if num in linenumbers:
print line.strip()
you judge for yourself.
that's quite true (although i don't quite like the way you put your braces). however, with the help of language syntax and features, it CAN be even clearer.
|
Again, it's people - "i" is unreadable in "[i.strip() for i in linenumbers]" - if I understand Python correctly, it should be
linenumbers = [line.strip() for line in linenumbers]
.
Regarding my braces - if you just ignore them, you'll get the same indentation as Python forces you to use.
|