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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:40:19+00:00 2026-06-14T08:40:19+00:00

This is my first Python project so it is very basic and rudimentary. I

  • 0

This is my first Python project so it is very basic and rudimentary.
I often have to clean off viruses for friends and the free programs that I use are updated often. Instead of manually downloading each program, I was trying to create a simple way to automate the process. Since I am also trying to learn python I thought it would be a good opportunity to practice.

Questions:

I have to find the .exe file with some of the links. I can find the correct URL, but I get an error when it tries to download.

Is there a way to add all of the links into a list, and then create a function to go through the list and run the function on each url? I’ve Google’d quite a bit and I just cannot seem to make it work. Maybe I am not thinking in the right direction?

import urllib, urllib2, re, os
from BeautifulSoup import BeautifulSoup

# Website List
sas = 'http://cdn.superantispyware.com/SUPERAntiSpyware.exe'
tds = 'http://support.kaspersky.com/downloads/utils/tdsskiller.exe'
mbam = 'http://www.bleepingcomputer.com/download/malwarebytes-anti-malware/dl/7/?1'
tr = 'http://www.simplysup.com/tremover/download.html'
urllist = [sas, tr, tds, tr]
urrllist2 = []

# Find exe files to download

match = re.compile('\.exe')
data = urllib2.urlopen(urllist)
page = BeautifulSoup(data)

# Check links
#def findexe():
for link in page.findAll('a'):
    try:
        href = link['href']
        if re.search(match, href):
            urllist2.append(href)

    except KeyError:
        pass

os.chdir(r"C:\_VirusFixes")
urllib.urlretrieve(urllist2, os.path.basename(urllist2))

As you can see, I have left the function commented out as I cannot get it to work correctly.

Should I abandon the list and just download them individually? I was trying to be efficient.

Any suggestions or if you could point me in the right direction, it would be most appreciated.

  • 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-06-14T08:40:20+00:00Added an answer on June 14, 2026 at 8:40 am

    In addition to mikez302’s answer, here’s a slightly more readable way to write your code:

    import os
    import re
    import urllib
    import urllib2
    
    from BeautifulSoup import BeautifulSoup
    
    websites = [
        'http://cdn.superantispyware.com/SUPERAntiSpyware.exe'
        'http://support.kaspersky.com/downloads/utils/tdsskiller.exe'
        'http://www.bleepingcomputer.com/download/malwarebytes-anti-malware/dl/7/?1'
        'http://www.simplysup.com/tremover/download.html'
    ]
    
    download_links = []
    
    for url in websites:
        connection = urllib2.urlopen(url)
        soup = BeautifulSoup(connection)
        connection.close()
    
        for link in soup.findAll('a', {href: re.compile(r'\.exe$')}):
            download_links.append(link['href'])
    
    for url in download_links:
        urllib.urlretrieve(url, r'C:\_VirusFixes', os.path.basename(url))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first python project. I am having issues setting up a project
I am trying to write my very first python script. This was working but
I have a task in Python and i run this task for first time
This is my first time do programming; i have a project that requires netwok
I have finished my first Django/Python Project and now I need to put the
I am working on my first large python project. I have one function which
This is the first Python script I've tried to create. I'm reading a xml
This is pretty strange (admitedly, this is my first attempt with python / sqlite),
I'm fairly new to both Django and Python. This is my first time using
I'm using the first answer to this question Overcoming Python's limitations regarding instance methods

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.