[Chicago] Need Python -2.4.3 help

Yarko Tymciurak yarkot1 at gmail.com
Mon Mar 17 16:15:49 CET 2014


Harry -

Just for your reference, see - for example:

http://isezen.com/2011/09/02/how-to-install-locally-python-on-linux-home-directory/

and

http://stackoverflow.com/questions/7465445/how-to-install-python-modules-without-root-access

For working out code in an area you're unfamiliar with, you might find the
autocompletion, ability to save your session, and interactivity of
http://bpython-interpreter.org/ helpful (its a shell for python).

Also, when I _had_ to deal w/ xml, I've repeatedly gravitated to lxml -
http://lxml.de/tutorial.html

Regards,
- Yarko





On Mon, Mar 17, 2014 at 9:13 AM, Harry aman <nharry99 at gmail.com> wrote:

> Hi,
>
> I'm new  to  Python.  The  installed  Python version  is  2.4.3  in Linux
> and  our admins are not willing to upgrade  it due to other comparability
> issues.
>
> The issue  is  related  to  reading  XML  file  and convert  it to a  txt
> file for further process.
>
> Here's the code  example.
> #read  XML  file  and convert  into  text  file for further process
> from xml.dom.minidom import parse, parseString
> dom=parse('/mnt/usr/Test.xml')
> outf = open ('/mnt/usr/Test.txt','w')
> attr_list = [
> 'col1',
> 'col2',
> 'col3',
> 'col4'
> ]
> for row in dom.childNodes[0].getElementsByTagName('z:row'):
>     for attr in attr_list:
>         if attr in row.attributes.keys():
>             outf.write(row.attributes[attr].value.encode("utf-8")+"\t")
>         else: outf.write("\t")
>     outf.write("\n")
> outf.close()
>
> I didn't  see any good example  to do this.   Please  let me know your
> suggestions.
>
> Thanks  in Advance.
>
> Regards
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> https://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20140317/8832dffc/attachment.html>


More information about the Chicago mailing list