Very newbie programming

TheSaint fc14301589 at icqmail.com
Sun Jun 11 11:08:20 EDT 2006


Maric Michaud wrote:

> Le Samedi 10 Juin 2006 17:44, TheSaint a écrit :
> devices = [ e for e in devices if e.split('/')[-1] in partitions ]

This is _not_ the expected result :)

is missing a not as :
devices = [ e for e in devices if e.split('/')[-1] *not* in partitions ]

>> if len(c) != 1:
>>         sys.exit(0) # if none or more than one match exit
>>
>> cmnd = str(c)[2:-2]
>> err = os.system('umount ' + cmnd)
> 
> why ?
> 
> os.system('umount "%s"' % devices[0])

>     for line in icon_file :
>         if  'URL=/media' in line :
>             icon = icon.name
>             dvc = line[11:-1]
>             break

The question is correct, I should go a step further. But as it will unmount
multiple (ghost) partitions it should also remove the icons from the
desktop as well. So I'm bit confused how to remove *each* icon, unless do
it into the "for" loop.
I'd like to get the search as fast as possible and solve the appropriate
icon with the right device, after all :)
Suppose to have the pendrive and the Compact Flash, which both are mounted
in /media, what will be removed syncronized with its mount?
I didn't get this problem so deep as long as I just considered to use one
device at time.

F




More information about the Python-list mailing list