2017-03-13 2 views
0

: GO 결과 : 여기 http://www.hltv.org/?pageid=188&statsfilter=2816&offset=0삭제 된 텍스트 라인은이 사이트 CS 긁어하기 위해 노력하고있어

내 코드입니다 :

import requests, re 
from bs4 import BeautifulSoup 

r=requests.get("http://www.hltv.org/?pageid=188&statsfilter=2816&offset=0") 
c=r.content 

soup=BeautifulSoup(c,"html.parser") 

for string in soup.find_all("div",{"class":"covSmallHeadline"}): 
    print(string.text.replace("(","").replace(")","")) 

출력은 다음과 같습니다

CS:GO - ScreaM's Team History Shown In A Different Way 
Date 
Team1 
Team2 
Map 
Event 
5/3 17 
Astralis 16 
FaZe 13 
inferno 
IEM Katowice 2017 
5/3 17 
Astralis 16 
FaZe 12 
nuke 
IEM Katowice 2017 
5/3 17 
Astralis 16 
FaZe 12 
overpass 
IEM Katowice 2017 
5/3 17 
FaZe 16 
Astralis 9 
cache 
IEM Katowice 2017 
4/3 17 
Astralis 16 
Heroic 12 
nuke 
IEM Katowice 2017 
4/3 17 
Astralis 16 
Heroic 12 
train 
IEM Katowice 2017 
4/3 17 
Immortals 10 
FaZe 16 
mirage 
IEM Katowice 2017 
4/3 17 
FaZe 16 
Immortals 9 
inferno 
IEM Katowice 2017 
3/3 17 
Natus Vincere 2 
Astralis 16 
nuke 
IEM Katowice 2017 
3/3 17 
Natus Vincere 11 
Astralis 16 
mirage 
IEM Katowice 2017 
3/3 17 
Immortals 16 
North 6 
cbble 
IEM Katowice 2017 
3/3 17 
North 19 
Immortals 15 
overpass 
IEM Katowice 2017 
3/3 17 
Immortals 16 
North 14 
cache 
IEM Katowice 2017 
2/3 17 
Virtus.pro 14 
Heroic 16 
nuke 
IEM Katowice 2017 
2/3 17 
Cloud9 6 
Natus Vincere 16 
mirage 
IEM Katowice 2017 
2/3 17 
SK 16 
North 8 
cbble 
IEM Katowice 2017 
2/3 17 
Cloud9 12 
North 16 
cbble 
IEM Katowice 2017 
2/3 17 
Natus Vincere 12 
Heroic 16 
overpass 
IEM Katowice 2017 
2/3 17 
Virtus.pro 16 
SK 14 
inferno 
IEM Katowice 2017 
2/3 17 
North 16 
Natus Vincere 12 
cbble 
IEM Katowice 2017 
2/3 17 
Virtus.pro 16 
Cloud9 4 
mirage 
IEM Katowice 2017 
2/3 17 
SK 16 
Heroic 5 
mirage 
IEM Katowice 2017 
2/3 17 
North 16 
Virtus.pro 13 
cbble 
IEM Katowice 2017 
2/3 17 
Cloud9 16 
Heroic 7 
cbble 
IEM Katowice 2017 
2/3 17 
North 17 
Heroic 19 
nuke 
IEM Katowice 2017 
2/3 17 
Natus Vincere 16 
SK 12 
overpass 
IEM Katowice 2017 
2/3 17 
Cloud9 16 
SK 9 
nuke 
IEM Katowice 2017 
2/3 17 
Virtus.pro 9 
Natus Vincere 16 
train 
IEM Katowice 2017 
1/3 17 
Astralis 13 
Immortals 11 
train 
IEM Katowice 2017 
1/3 17 
Astralis 2 
FaZe 4 
train 
IEM Katowice 2017 
1/3 17 
FaZe 10 
Immortals 7 
train 
IEM Katowice 2017 
1/3 17 
fnatic 14 
Immortals 16 
mirage 
IEM Katowice 2017 
1/3 17 
NiP 16 
OpTic 13 
inferno 
IEM Katowice 2017 
1/3 17 
Astralis 16 
FaZe 8 
train 
IEM Katowice 2017 
1/3 17 
OpTic 12 
FaZe 16 
train 
IEM Katowice 2017 
1/3 17 
Immortals 16 
NiP 14 
cbble 
IEM Katowice 2017 
1/3 17 
fnatic 17 
Astralis 19 
inferno 
IEM Katowice 2017 
1/3 17 
NiP 6 
FaZe 16 
cache 
IEM Katowice 2017 
1/3 17 
Immortals 16 
Astralis 12 
cache 
IEM Katowice 2017 
1/3 17 
fnatic 16 
OpTic 10 
train 
IEM Katowice 2017 
1/3 17 
OpTic 8 
Immortals 16 
inferno 
IEM Katowice 2017 
1/3 17 
fnatic 11 
FaZe 16 
train 
IEM Katowice 2017 
1/3 17 
NiP 24 
Astralis 28 
overpass 
IEM Katowice 2017 
1/3 17 
Immortals 6 
FaZe 16 
overpass 
IEM Katowice 2017 
1/3 17 
OpTic 12 
Astralis 16 
train 
IEM Katowice 2017 
1/3 17 
NiP 14 
fnatic 16 
cache 
IEM Katowice 2017 
20/2 17 
SK 13 
Virtus.pro 16 
mirage 
DreamHack Masters Las Vegas 2017 
20/2 17 
Virtus.pro 16 
SK 11 
train 
DreamHack Masters Las Vegas 2017 
20/2 17 
Virtus.pro 8 
SK 16 
cbble 
DreamHack Masters Las Vegas 2017 
19/2 17 
SK 16 
North 9 
mirage 
DreamHack Masters Las Vegas 2017 

"CS : GO - ScreaM의 팀 기록을 다른 방식으로 표시"- 첫 번째 줄에 나타나는 텍스트 출력의? 내 목표는 팬더 데이터 프레임에 결과를 가져 오는 것이며 텍스트 라인이 나를 방해하는 것입니다.

+0

당신이 공유 링크를 제거하는 방법이 문제 –

+0

예 그게 사실 나는 그 혼란 스러워요 왜 내 코드 출력에 설명과 같은 데이터를 표시 나던 최고 웹 사이트에 표시되지 않기 때문에 텍스트 줄을 제공합니다. –

답변

0
for string in soup.find_all("div",{"class":"covSmallHeadline"})[1:]: 
    print(string.text.replace("(","").replace(")","")) 

사용 slice은 첫 번째 줄

+0

대단히 감사합니다! :) –

+0

@Juho M 내 대답을 수락 하셔도됩니다. –