[BangPypers] File operations
Noufal Ibrahim
noufal at gmail.com
Wed Oct 19 13:58:13 CEST 2011
Shashidhar Paragonda <shashidhar85 at gmail.com> writes:
> Dear Noufal,
>
> Thanks for your reply
> I did in this way is it efficient way to achieve the same requirement
Doesn't seem so to me. You're going over the lines of the file once
without and two times within for each of those iterations. You should
use a set or a dictionary rather than lists if you want to do membership
tests.
Also, this
all_lines_in_file[line].split('->')[1].split(')')[0].split("'")[1].strip()
is liable to bite you later. I'd suggest you try to simplify it or
atleast wrap it up in a function with a nice name.
[...]
--
~noufal
http://nibrahim.net.in
This report is filled with omissions.
More information about the BangPypers
mailing list