import requests
import pandas as pd
import numpy as np
import csv
res = requests.get("https://isin.twse.com.tw/isin/class_main.jsp?owncode=&stockname=&isincode=&market=1&issuetype=1&industry_code=&Page=1&chklike=Y")
df = pd.read_html(res.text)[0]
df = df.drop([0,1,5,8,9],axis=1)
df.columns = df.iloc[0]
df = df.iloc[1:]
df = df.set_index("有價證券名稱")
df = df.to_csv()
print(df)
with open('D:\A/df.csv','a',encoding ='utf-8')as csvfile:
writer = csv.writer(csvfile)
writer.writerow(df)
我想把抓下來的網頁資料轉成excel可是轉成之後反而會出現亂碼要怎麼更改
還有一個問題是能不能只把有"價證券名稱"這段資料留下就好?