by Anonymous » 28 Feb 2025, 06:00
Wie mache ich es so, dass jedes Bild, das ich aus Web -Scraping erzielt habe, dann in einem Ordner gespeichert wird? Ich benutze Google Colab derzeit, da ich nur Sachen übe.
Ich möchte sie in meinem Google Drive -Ordner speichern.
Code: Select all
import requests
from bs4 import BeautifulSoup
def getdata(url):
r = requests.get(url)
return r.text
htmldata = getdata('https://www.yahoo.com/')
soup = BeautifulSoup(htmldata, 'html.parser')
imgdata = []
for i in soup.find_all('img'):
imgdata = i['src']
print(imgdata)
Wie mache ich es so, dass jedes Bild, das ich aus Web -Scraping erzielt habe, dann in einem Ordner gespeichert wird? Ich benutze Google Colab derzeit, da ich nur Sachen übe. [url=viewtopic.php?t=14917]Ich möchte[/url] sie in meinem Google Drive -Ordner speichern.[code]import requests
from bs4 import BeautifulSoup
def getdata(url):
r = requests.get(url)
return r.text
htmldata = getdata('https://www.yahoo.com/')
soup = BeautifulSoup(htmldata, 'html.parser')
imgdata = []
for i in soup.find_all('img'):
imgdata = i['src']
print(imgdata)
[/code]