On Thu, 2007-02-15 at 17:17 +0100, Dirk Meyer wrote:
>          elif line.startswith("ID_") and line.find("=") != -1:

This is more pythonic:

   elif line.startswith('ID_') and '=' in line:


> -            attr, value = line.split("=")
> -            attr = attr[3:]
> +            # attr, value = line.split("=") could crash if the filename
> +            # contains a '=' (which could happen very easy in an http url)
> +            attr = line[3:line.find('=')]
> +            value = line[line.find('=')+1]

Don't you just want to split on the first equal sign?  Shouldn't this
work:

   attr, value = line.split('=', 1)
   attr = attr[3:]

It's much cleaner.

P.S. Sorry I haven't been around much.  I've been unusually busy with
work.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to