이 url의 두 번째 tbody에서 열 머리글을 가져와야합니다.여러 개의 HTML에서 열 머리글 얻기 'tbody'
runfile('C:/Python27/Lib/site-packages/xy/workspace/webscrape/mpob1.py', wdir='C:/Python27/Lib/site-packages/xy/workspace/webscrape')
Traceback (most recent call last):
File "<ipython-input-8-ab4005f51fa3>", line 1, in <module>
runfile('C:/Python27/Lib/site-packages/xy/workspace/webscrape/mpob1.py', wdir='C:/Python27/Lib/site-packages/xy/workspace/webscrape')
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Python27/Lib/site-packages/xy/workspace/webscrape/mpob1.py", line 26, in <module>
soup.findAll('tbody', limit=2)[1].findAll('tr').findAll('th')]
IndexError: list index out of range
여기 사람이 나를 도와주세요 수 있습니다
http://bepi.mpob.gov.my/index.php/statistics/price/daily.html
특히, 난 등 "9 월, 10 월"...
나는 다음과 같은 오류를 얻고을보고 싶다 아웃? 나는 영원히 감사 할 것이다!
import requests
from bs4 import BeautifulSoup
import pandas as pd
url = "http://bepi.mpob.gov.my/index.php/statistics/price/daily.html"
r = requests.get(url)
soup = BeautifulSoup(r.text, 'lxml')
column_headers = [th.getText() for th in
soup.findAll('tbody', limit=2)[1].findAll('tr').findAll('th')]
당신은 의미합니까, 당신은 단지 달 선택 요소의 내용이 필요하거나 실제로 필요 "View Price"를 클릭하고 "MPOB DAILY FFB REFERENCE PRICE SUMMARY BY REGION"테이블을 구문 분석 하시겠습니까? 감사합니다 – alecxe
'가격보기'를 클릭해야합니다. 문제가되는 테이블은 '말레이시아 반도 : RBD P. Oil, RBD P.Olein & RBD P. Stearin'의 현지 가격 요약 –