Very newbie programming
Alexander Schmolck
a.schmolck at gmail.com
Sat Jun 10 12:49:47 EDT 2006
TheSaint <fc14301589 at icqmail.com> writes:
> # Filling the c with the list of devices which are recorded to be mounted
>
> d = filter((lambda a: a[:2] =='/d'),mnt.readlines()) # non /dev-mounts are
> off
> d = map((lambda a: a.split()[:1]),d) # only the first info column is used
Just focusing one one detail:
1. you don't need the parens around the lambda
2. you can just write the above as
d = [a.split()[:1] for a in mnt if a.startswith('/d')]
'as
More information about the Python-list
mailing list