Development/Python
python_re_study...7
Kirok Kim
2021. 12. 21. 23:00
Library
- pickle
- ๊ฐ์ฒด์ ํํ ๊ทธ๋๋ก ์ ์งํ๋ฉด์ ํ์ผ ์ ์ฅํ๊ณ ๋ถ๋ฌ์ฌ ์ ์๊ฒ ํ๋ ๋ชจ๋
import pickle f = open("test.txt", 'wb') data = {1: 'python', 2: 'you need'} pickle.dump(data, f) f.close() f = open("test.txt", 'rb') data = pickle.load(f) print(data) >>> {2:'you need', 1:'python'}
- shutil
-
import shutil shutil.copy("src.txt",'dst.txt') # src๋ผ๋ ํ์ผ์ด๋ฆ์ผ๋ก dst ๋๋ ํ ๋ฆฌ์ ๋ณต์ฌํ๊ณ ๋์ผํ ํ์ผ ์ด๋ฆ์ผ๋ก # ์์ ๋๋ ๋ฎ์ด์ด๋ค.
- glob
-
import glob glob.glob("c:/doit/mark*") ['c:/doit\\\\marks1.py', 'c:/doit\\\\marks2.py', 'c:/doit\\\\ma rks3.py'] # ๋์ ๋๋ ํฐ๋ฆฌ์ ์๋ ํ์ผ ์ค ์ด๋ฆ์ด mark๋ก ์์ํ๋ ํ์ผ์ ๋ชจ๋ ์ฐพ์์ ๋ฆฌํด
- time
-
import time time.time() 988458015.73417199 time.localtime time.struct_time(tm_year=2013, tm_mon=5, tm_mday=21, tm_hour=16,tm_min=48, tm_sec=42, tm_wday=1, tm_yday=141, tm_isdst=0) time.asctime(time.localtime(time.time())) 'Sat Apr 28 20:50:20 2001' ==> time.ctime() 'Sat Apr 28 20:56:31 2001' time.strftime('%x', time.localtime(time.time())) '05/01/01' time.strftime('%c', time.localtime(time.time())) '05/01/01 17:22:21'
- random
-
import random random.random() random.randint(1,10)
- webbrowser
-
import webbrowser webbrowser.open("<http://google.com>")
์ฐธ๊ณ : https://wikidocs.net/book/1
์ ํ ํฌ ํ์ด์ฌ
** ์ ํ ํฌ ํ์ด์ฌ ์คํ๋ผ์ธ ์ฑ (๊ฐ์ ํ) ์ถ๊ฐ !! (2019.06) ** * [์ฑ ๊ตฌ์ ์๋ด](https://wikidocs.net/4321) ์ด ์ฑ ์ ํ์ด์ฌ ...
wikidocs.net
๋ฐ์ํ