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

  • Home
  • SEARCH
  • 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 5972329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:38:33+00:00 2026-05-22T20:38:33+00:00

Hello I am trying to make a python function to save a list of

  • 0

Hello I am trying to make a python function to save a list of URLs in .txt file

Example: visit http://forum.domain.com/ and save all viewtopic.php?t= word URL in .txt file

http://forum.domain.com/viewtopic.php?t=1333
http://forum.domain.com/viewtopic.php?t=2333

I use this function but not save
I am very new in python can someone help me to create this

web_obj = opener.open('http://forum.domain.com/')
data = web_obj.read()

fl_url_list = open('urllist.txt', 'r')
url_arr = fl_url_list.readlines()
fl_url_list.close()
  • 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-22T20:38:33+00:00Added an answer on May 22, 2026 at 8:38 pm

    This is far from trivial and can have quite a few corner cases (I suppose the page you’re referring to is a web page)

    To give you a few pointers, you need to:

    • download the web page : you’re already doing it (in data)
    • extract the URLs : this is hard, most probably, you’ll want to usae an html parser, extract <a> tags, fetch the hrefattribute and put that into a list. then filter that list to have only the url formatted like you like (say with viewtopic). Let’s say you got it into urlList
    • then open a file for Writing Text (thus wt, not r).
    • write the content f.write('\n'.join(urlList))
    • close the file

    I advise to try to follow these steps and ask relevant questions when you’re stuck on a particular issue.

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

Sidebar

Related Questions

I'm just trying to compile the hello world example of boost.python WITHOUT using all
hello i am trying to make it so that when you visit my site
Hello all im trying to make this slide effect http://tinyurl.com/628z32d but im new to
Hello i'm trying to make the following GET request thru CURL GET http://localhost:80/ HTTP/1.1
I'm trying to make a simple hello-world executable python gui app in windows using
Hello I am trying to save a bitmap image in a basic image editor
I can't create an utf-8 csv file in Python. I'm trying to read it's
hello i am trying to make a map containing objects as the following :
I'm trying to make a little Hello World webservice with Django following a few
I'm trying to make a pop up message box with Hello World written on

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.