Very newbie programming

Alexander Schmolck a.schmolck at
Sat Jun 10 18:49:47 CEST 2006

TheSaint <fc14301589 at> 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')]


More information about the Python-list mailing list