Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 162279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:21:45+00:00 2026-05-11T11:21:45+00:00

I did something similar to this , but couldn’t find a way to write

  • 0

I did something similar to this, but couldn’t find a way to write the result to an xml file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:21:45+00:00Added an answer on May 11, 2026 at 11:21 am

    The code on the web page you linked to uses doc.toprettyxml to create a string from the XML DOM, so you can just write that string to a file:

    f = open('output.xml', 'w') try:     f.write(doc.toprettyxml(indent='  ')) finally:     f.close() 

    In Python 2.6 (or 2.7 I suppose, whenever it comes out), you can use the ‘with‘ statement:

    with open('output.xml', 'w') as f:     f.write(doc.toprettyxml(indent='  ')) 

    This also works in Python 2.5 if you put

    from __future__ import with_statement 

    at the beginning of the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this has been asked before, I did check but couldn't find anything...
I did do some googling and searching on this site but did not find
I did some research on the topic but could not find anything similar to
I did something similar to: http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/ and just like the original it works in
Well,I am trying to do something similar what I did in Adobe Flex.Consuming a
I did something like this to initially hide the body scrollbar, and then show
I need to do form validation, I even did something like this on one
So I read the tutorial from some web, and they did something like this.
Is there a way to create non blocking/asynchronous named pipe or something similar in
I did post this on serverfault, but not getting any views or responses. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.