python(0821-0908)/메모

코랩 : 셀레니움, 구글 드라이브 파일 저장

나도초딩 2022. 9. 8.

코랩엔 우분투 도커가 들어있었어...

공짜로 리눅스를 주네. -_- 우분투 18.04

코랩 파일 다루기 (구글 드라이브에서)

# /content/drive/My Drive/Colab Notebooks/

f = open("/content/drive/My Drive/Colab Notebooks/voca_db.txt", 'w', encoding="utf8")
    f.write("ㅇㅇㅇ')
f.close()

코랩에서 셀레니움 크롬드라이버

#!pip uninstall selenium
#!pip install selenium==3.141
#!apt-get update
#!apt autoremove

!pip install selenium
!apt install chromium-chromedriver
 
 
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('chromedriver', options=chrome_options)

url = 'https://ko.wiktionary.org/wiki/%EB%B6%80%EB%A1%9D:%EC%9E%90%EC%A3%BC_%EC%93%B0%EC%9D%B4%EB%8A%94_%ED%95%9C%EA%B5%AD%EC%96%B4_%EB%82%B1%EB%A7%90_5800'
driver.get(url)

댓글