일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- python3
- Python
- Nginx
- parser
- BLE
- orange pi
- 아두이노
- java
- RUBY
- Android
- uno
- Raspberry Pi 3
- ubuntu
- nano
- flask
- STM32F4
- Beacon
- 개발환경
- dht11
- mqtt
- IOT
- 라즈베리파이
- docker
- Raspberry Pi
- Arduino
- Server
- rails
- 오렌지파이
- ruby on rails
- odroid-x2
- Today
- Total
목록Programming/python (14)
[熱情]
python 3.5 from multiprocessing import Process import time import os def func1(data): for i in range(0, 10): print(data) def func2(): for i in range(0, 10): print("bye~!") def func3(): print('module name : ', __name__) if hasattr(os, 'getppid'): print('parent process : ', os.getppid()) print('process id : ', os.getpid()) if __name__ == "__main__": proc1 = Process(target=func1, args=("hello",)) p..
python 3.5 import json sample_data = '{ "num" : 123, "name": "bbb", "phone": "01012345678", "email": "asdf@qwer@net" }' def json_parser(data): try: jdata = json.loads(sample_data) print("num : ", jdata["num"]) print("name : ", jdata["name"]) print("phone : ", jdata["phone"]) print("email : ", jdata["email"]) except(KeyError, TypeError, ValueError) as e: print("json parser error : ", e) if __name..
import sys try: user_input = input() except KeyboardInterrupt: print("Keyboard interrpt : ctrl + c") sys.exit(0)
파이썬에서 thread보다 멀티 프로세싱을 더 선호한다고한다.. 관련된 예제를 보여주는 블러그.. http://leosworld.tistory.com/13 http://qkqhxla1.tistory.com/270 http://hashcode.co.kr/questions/691/%ED%8C%8C%EC%9D%B4%EC%8D%AC%EC%9C%BC%EB%A1%9C-%EB%A9%80%ED%8B%B0%ED%94%84%EB%A1%9C%EC%84%B8%EC%8B%B1-vs-%EB%A9%80%ED%8B%B0-%EC%8A%A4%EB%A0%88%EB%94%A9 from multiprocessing import Process, Queue import time def do_work(start, end, result): sum ..