python and parsing an xml file

Paul Anton Letnes paul.anton.letnes at gmail.com
Tue Feb 22 07:33:33 EST 2011


Den 22.02.11 13.29, skrev python at bdurham.com:
> Paul,
>
>> How about skipping the whole xml thing? You can dynamically import any python module, even if it does not have a python filename.
>
> Great example!
>
> Can you do the same with a cStringIO based file that exists in memory
> vs. on disk? Your example requires a physical file on disk. Is it
> possible to accomplish the same using a string vs. a file or temporary
> file?
>
> Thank you,
> Malcolm (not the OP)

Malcolm,

I never had the interest, so I did not try. Why don't you just try it? 
Just insert your StringIO file into the function and see if it works, or 
if it crashes and burns. Let me know what you find out!

Anyway, you could always just write a temporary file. It won't consume a 
lot of resources, I imagine.

Cheers,
Paul



More information about the Python-list mailing list