이것은 (위도, 경도) 별도로 갖고 싶은 값 (좌표)입니다.[Python3x] : 두 값을 따로 추출하는 법 (beautifulsoup)?
<input id="dokad" value="51.819544, 19.30441" type="hidden">
내가 그렇게 할 때 :
lat_lon = soup.find('input', attrs={'id':'dokad'}).get('value')
결과 :
lat_lon
Out[1012]: '51.186147, 19.199997'
type(lat_lon)
Out[1013]: str
가 어떻게 별도로이 두 값을 추출 할 수 있습니다? 지금 lat_lon = [float(number) for number in lat_lon]
:이 작업을 수행하여 떠 목록 요소를 변환 한 후
lat_lon = lat_lon.split(', ')
- 을 그리고 : 당신의 문자열을 변환 한 후
float()
을 문자열을 분할하는
모든 것이 작동합니다. 고맙습니다. – BigD