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 6180171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:48:02+00:00 2026-05-24T00:48:02+00:00

this may be a truly stupid question but I haven’t readily found the answer.

  • 0

this may be a truly stupid question but I haven’t readily found the answer.
once i modify the xml tree as necessary, how do I write it back out to file?

code:

workbook = open("C:\\Users\\rabdel.WINCMPT\\Documents\\Retail Footwear.twb")
soup = BeautifulSoup(workbook)

for dashboard in soup.findAll("dashboard"):
    print dashboard["name"]
    if dashboard["name"] == "S1":
        dashboard.extract()

for window in soup.findAll("window"):
    print "class:",window["class"]
    if "name" in [x[0] for x in window.attrs]:
        print "name:",window["name"]
        if window["name"] == "S1":
            window.extract()
  • 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. Editorial Team
    Editorial Team
    2026-05-24T00:48:03+00:00Added an answer on May 24, 2026 at 12:48 am

    Simplest way, get the output as a string and write to file:

    f = open(workbook.name, "w")
    f.write(soup.prettify())
    f.close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may be a stupid question, but I'm still learning so do forgive me
This may sound basic for a question but I never had a formal (if
this may be a simple question but am struggling to understand how to solve
Okay, I think I might be over-complicating this issue but I truly am stuck.
I must apologize if this is a duplicate question, but I can't seem to
This may be quite simple but I'm rather new to Lambda's so bear with
This may initially seem generic, but in fact, I am actually making the decision
This may seem simple, but somehow it isn't. I have a table of historical
This may either be a silly question or i've searched for the wrong words:
This may not be possible, but I have a DIV that I am transforming

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.