반응형 Tools & Tips/code_snippets4 meta tag 크로링 (feat. python) 다음과 같은 meta 테그의 특정 속성만 추출하고 싶은 경우가 있다 source_id = '25441767' # source_id = '1000623206' rq = requests.get(new_url + source_id, headers=rnd_header) souprq = BeautifulSoup(rq.content, 'html.parser') souprq.select('meta') poi = souprq.select_one('meta[property="og:title"]')['content'] address = souprq.select_one('meta[property="og:description"]')['content'] # '당신을 좋은 곳으로 안내 할 지도' == None print(poi).. Tools & Tips/code_snippets 2022. 12. 16. GPU memory 상태 확인 방법 HTML 삽입 미리보기할 수 없는 소스 Tools & Tips/code_snippets 2022. 9. 25. jupyter notebook 한글 폰트 적용 방법 # 파이썬 시각화 패키지 불러오기 import matplotlib import matplotlib.pyplot as plt # import matplotlib.font_manager as font_manager from matplotlib import font_manager, rc import platform print(f"platform = {platform.system()}") # OS platform 확인 font_fpath = './malgun.ttf' # 폰트 파일(.ttf) 경로 fontprop = font_manager.FontProperties(fname=font_fpath, size=12) # 폰트 경로 및 사이즈 font_name = font_manager.FontProperties(f.. Tools & Tips/code_snippets 2022. 9. 14. 구글 코랩(google colab) 환경인지 아닌지 확인하는 방법 다음은 자연어 모델 학습을 위한 기본 환경 설정이다. 해당 코드를 jupyter notebook 상단에 실행하면 COLAB / PC 환경을 확인, COLAB일 경우 구글드라이브 연동 및 라이브러리 체크와 설치, PC일 경우 라이브러리 체크 및 설치를 진행하며, GPU 가 있는 경우를 가정하여 torch 환경을 설치함 # 자연어 처리 환경 requirements # colab try: import google.colab IN_COLAB = True except: IN_COLAB = False # print(IN_COLAB) if IN_COLAB: # google drive setting from google.colab import drive drive.mount('/content/drive') import.. Tools & Tips/code_snippets 2022. 9. 14. 이전 1 다음 💲 Google Ads. 반응형