Generation

generate functionThu, 23 Mar 2023

Write code in Python that downloads all the names of the text files in the folder: http://stup.pro/wp-content/uploads/2023/03/*.txt into one list book_files

import requests def get_all_files_names(url): links = [] response = requests.get(url) html_doc = response.text soup = BeautifulSoup(html_doc, 'html.parser') for link in soup.find_all('a'): links.append(link.get('href')) links = list(filter(lambda x: x.endswith('.txt'), links)) return links get_all_files_names('http://stup.pro/wp-content/uploads/2023/03/')

Questions about programming?Chat with your personal AI assistant