我试图刮一个网站上的表,然后转换成一个CSV格式。不管我的代码是什么都没有显示。你能告诉我哪里出了问题吗
网址:http://www.multiclick.co.kr/sub/gamepatch/gamerank.html
别担心语言。请在日历上设置比今天早一两天的日期,然后单击放大镜。然后你就能看到一张桌子了
# Load the required modules
import urllib
from bs4 import BeautifulSoup
import pandas as pd
# Open up the page
url = "http://www.multiclick.co.kr/sub/gamepatch/gamerank.html"
web_page = urllib.request.Request(
url,
data = None,
headers={'User-Agent': ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/35.0.1916.47 Safari/537.36")})
type(web_page)
web_page = urllib.request.urlopen(web_page)
# Parse the page
soup = BeautifulSoup(web_page, "html.parser")
print(soup)
# Get the table
# Get the columns
# Get the rows
# Stack them altogether
# Save it as a csv form
Ais@mx0说,与其获取main页面,不如获取ajax调用,例如:
相关问题 更多 >
编程相关推荐