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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:45:13+00:00 2026-05-26T23:45:13+00:00

I have a python file ( html2text.py ) which gives the desired result when

  • 0

I have a python file (html2text.py) which gives the desired result when i pass command line argument to it i.e., in the following way:

python html2text.py file.txt
  • where file.txt contains the source code of a web-site and the result is displayed on the console…

I want to use it in another file (let say a.py) and store the result (which was getting printed on the console) in a string.

For this I need to first import the file (html2text.py) in my file (a.py). Can anyone tell me how do I proceed further…?

  • 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-26T23:45:14+00:00Added an answer on May 26, 2026 at 11:45 pm

    Good way is to create some API in your html2text.py. For example:

    # html2text.py
    
    def parse(filename):
        f = open(filename)
        # do the stuff
        return output_string
    
    def main():
        import sys
        print parse(sys.argv[1])
    
    if __name__ == '__main__':
        main()
    

    Then you will be able to use it in your a.py:

    import html2text # main() will not run
    import sys
    
    output = html2text.parse(sys.argv[1])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python file testHTTPAuth.py which uses module deliciousapi and is kept in
I have a python class which reads a config file using ConfigParser: Config file:
I have a small python script which i use everyday......it basically reads a file
I have defined a .dir-locals.el file with the following content: ((python-mode . ((cr/virtualenv-name .
Say I have this simple python script: file = open('C:\\some_text.txt') print file.readlines() print file.readlines()
I have an HTTP server which host some large file and have python clients
Good Early Morning, I have the following python regex file that we established on
I have a Python file which might have to support Python versions < 3.x
I have a Visual Studio project which uses nmake to call a Python file
I have a Python file with as content: import re import urllib class A(object):

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.