第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 Python 中將數(shù)組輸出保存到 csv

在 Python 中將數(shù)組輸出保存到 csv

泛舟湖上清波郎朗 2021-11-02 10:17:55
我正在嘗試從網(wǎng)站上抓取數(shù)據(jù)。我正在制作一個循環(huán)來提取數(shù)據(jù)并存儲在一個變量中,但無法將其保存在 csv 文件中。作為 Python 和 BeautifulSoup 的新手,我并沒有走多遠。這是代碼:import requestsfrom bs4 import BeautifulSoupimport csvr = "https://sofia.businessrun.bg/en/results-2018/"content = requests.get(r)soup = BeautifulSoup(content.text, 'html.parser')for i in range (1,5):    team_name= soup.find_all(class_="column-3")    team_time= soup.find_all(class_="column-5")for i in range (1,5):  print (team_name[i].text)  print (team_time[i].text)with open("new_file.csv","w+") as my_csv:    csvWriter = csv.writer(my_csv,delimiter=',')    csvWriter.writerows(team_name)任何幫助將不勝感激!
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 744 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號