[Python] 파이썬으로 MySQL DB 연결 후 데이터 출력하는 코드 mysql root 계정 패스워드는 본인의 패스워드로 바꿔서 실행 ### MySQL 으로 DB 연결 후 데이터 출력~!! import pymysql conn = pymysql.connect(host='127.0.0.1', user='root', passwd='your password', db='mysql') cur = conn.cursor() cur.execute("USE scraping") cur.execute("SELECT * FROM pages WHERE id=1") print(cur.fetchone()) cur.close() conn.close()
### test.csv 파일을 생성 후 데이터를 저장하는 코드 import csv csvFile = open('test.csv', 'w+') try: writer = csv.writer(csvFile) writer.writerow(('number', 'number plus 2', 'number plus 3')) for i in range(5): writer.writerow( (i, i+2, i+3)) finally: csvFile.close()
pytesseract를 사용하여, 이미지의 text 출력 code: from PIL import Image import pytesseract pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe' print(pytesseract.image_to_string(Image.open('./test.png'))) output: I watch three climb before it’s my turn.[lit’s a tough one.|ilithe guy before me tries twice.[ll He falls tuice.[lAfter the last one, he cones down,lie’s finished ..
- Total
- Today
- Yesterday
- URL열기
- 보안
- 보안기술정보
- 오류해결
- maware
- python
- 브라우저실행
- zerosecu
- malware
- 파이썬웹크롤러
- 악성코드
- 악성메일분석
- 바이러스토탈
- emailhacking
- 멀웨어
- 악성코드분석
- hacking
- 바이러스
- 파이썬
- python3
- Security
- 해킹
- 웹크롤링
- 바이러스토탈 사용법
- 분석도구
- zerosecurity
- 웹크롤링기초
- virus
- 악성코드분석도구
- 파이썬개발환경
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |