import requests
# URL of the Python 3.8 download page
download_url = "https://www.python.org/downloads/release/python-380/"
# Send a request to the download page
response = requests.get(download_url)
# Get the direct download link for Python 3.8
start_index = response.text.find('"/ftp/python/3.8.')
end_index = response.text.find('.tar.xz', start_index)
direct_download_link = response.text[start_index+1:end_index+7]
# Download Python 3.8 installer
print("Downloading Python 3.8 installer...")
response = requests.get("https://www.python.org" + direct_download_link)
# Save the installer to a file
filename = direct_download_link.split('/')[-1]
with open(filename, 'wb') as file:
file.write(response.content)
# Print the location of the downloaded installer
print("Python 3.8 installer downloaded successfully!")
print("Saved as", filename)