python queue를 이용한 multiprocessing 기초 뼈대 import multiprocessing #동작 실행 함수 def do_work(item): print item #Queue 전달 함수 def worker(q): for item in iter(q.get, None): do_work(item) q.task_done() q.task_done() #메인 함수 def main(): #동작 프로세스 개수 num_procs = 5 #큐 데이터 items = [1,2,3,4,5,6,7,8,9,10] q = multiprocessing.JoinableQueue() procs = [] for i in range(num_procs): procs.append(multiprocessing.Process(..
1. fake-useragent 설치pip install fake-useragent 2. fake-useragent 사용법from fake_useragent import UserAgent ua = UserAgent() print (ua.ie) # Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US); print (ua.msie) # Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)' print (ua['Internet Explorer']) # Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; G..
1. pip install termcolor 2. source from termcolor import colored, cprint print colored("ABCDEFG", "red") print colored("ABCDEFG", "green") print colored("ABCDEFG", "yellow") print colored("ABCDEFG", "blue") print colored("ABCDEFG", "grey") print colored("ABCDEFG", "magenta") print colored("ABCDEFG", "cyan") print colored("ABCDEFG", "white") cprint('Hello, World!', 'white', 'on_red') cprint('Hell..
1. python3 소스 코드#_*_ coding:utf8 _*_ import urllib.request from bs4 import BeautifulSoup fp = urllib.request.urlopen('http://info.finance.naver.com/marketindex/exchangeList.nhn') source = fp.read() fp.close() class_list = ["tit","sale"] soup = BeautifulSoup(source,'html.parser') soup = soup.find_all("td", class_ = class_list) money_data={} for data in soup: if soup.index(data)%2==0: data=data.ge..
- Total
- Today
- Yesterday
- 파이썬
- 우분투
- python3
- tar 압축
- 도커 사용법
- 뉴스기사번역
- multiprocess
- 파이썬 병렬
- python thread
- 우분트 프로세스 백그라운드
- terminal print color
- 파이썬 user-agent
- 파이썬3 크롤러
- apt-get error
- 도커 설치
- docker 설치
- docker 사용법
- python color print
- python3 환율
- multiprocessing
- python3 파싱
- python queue
- python3 환율 api
- termcolor
- python
- 파이썬 파싱
- 우분투 tar
- python multiprocess
- 파이썬 웹파싱
- python web framework
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |