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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:57:01+00:00 2026-05-22T23:57:01+00:00

I am trying to determine the best way to save an unknown string on

  • 0

I am trying to determine the best way to save an unknown string on a web page that relates to a specific tag, using Python. E.g.

<div class="pictures">
    <img src="http://some.unknownaddress.com/random_image.jpg" alt="" class="image" height="123" width="123">

What I wish to pull out is the images URL address and use it to download the image. The class “pictures” is unique to the page so I gather I can use that as a reference point to grab the URL, but what I’m not sure of is how to write the code to specifically select what even URL is inbetween the ” ” following that “pictures” class.

I am thinking down the line of using re, but have no idea how to concoct a string to make it select that particualar string. Should I be using Beautiful Soup to help?

Any help would be much appreciated.

Thanks,

Dog.

  • 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-22T23:57:02+00:00Added an answer on May 22, 2026 at 11:57 pm

    This is messy but would get the job done. Obviously it’d be better to break this down into functions, etc. to make it smoother. Note that I haven’t tested this script specifically, but I have written other scripts in this ilk to do similar things (break down html, add stuff in, and paste it back together, for instance). It’s a bit tedious, and not pretty, but again…it’ll work.

    start = 0
    end = 0
    charCount = -1
    imgTagLocation = []
    for character in SourceCode:
        charCount += 1
        if character == "<":
           start = charCount
           end = charCount + 4
           testString = SourceCode[start:end]
           if testString == "<img":
               imgTagLocation.append(start)
               endTag = None
               while not endTag:
                   if endTag:
                       break
                   else:
                      endCount = -1
                      for char in SourceCode[start:]:
                          endCount += 1
                          if char == ">":
                              endTag = start + endCount
                              imgTagLocation.append(endTag)
               imgTag = SourceCode[imgTagLocation[0]:imgTagLocation[1]
               startInImgTag = 0
               testString = "src"
               excerpt = ""
               while testString != excerpt:
                   if testString == excerpt:
                       [[continue to break this down until you are searching for the quotation marks within the "src" part of the img tag, and then return the string between those marks]]
                   endInImgTag = startInImgTag + 3
                   excerpt = imgTag[startInImgTag:endInImgTag]
                   startInImgTag += 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to determine the best way to implement a 404 page in a
I'm trying to determine the best way to organize our Maven / Spring web
I'm trying to determine the best way to truncate or drop extra decimal places
I'm trying to determine the best way of having a PHP script determine which
I'm trying to figure out the best way to determine whether I'm in the
Trying to determine best way to code this requirement : Need to insert rows
Am trying to determine the best way to persist information from an originating email,
I am trying to determine the best way to handle getting rid of newlines
I'm trying to determine the best way to ping a database via JDBC. By
I am trying to determine the best way to create a treeview list in

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.