>>> import datetime
>>> day1 = datetime.date(2019, 12, 14)
>>> day2 = datetime.date(2021, 6, 5)
>>> diff = day2 - day1
>>> diff.days
539
>>> import datetime
>>> day = datetime.date(2019, 12, 14)
>>> day.weekday()
5
>>> import time
>>> time.time()
988458015.73417199
>>> time.localtime(time.time())
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('출력할 형식 포맷 코드', time.localtime(time.time()))

>>> import time
>>> time.strftime('%x', time.localtime(time.time()))
'05/01/01'
>>> time.strftime('%c', time.localtime(time.time()))
'05/01/01 17:22:21'
import time
for i in range(10):
print(i)
time.sleep(1)
>>> import math
>>> math.gcd(60, 100, 80)
20
>>> import math
>>> math.lcm(15, 25)
75
>>> import random
>>> random.random()
0.53840103305098674
>>> random.randint(1, 10)
6
>>> random.randint(1, 55)
43
import itertools
students = ['한민서', '황지민', '이영철', '이광수', '김승민']
snacks = ['사탕', '초컬릿', '젤리']
result = itertools.zip_longest(students, snacks, fillvalue='새우깡')
print(list(result))
[('한민서', '사탕'), ('황지민', '초콜릿'), ('이영철', '젤리'), ('이광수', '새우깡'), ('김승민', '새우깡')]
>>> import itertools
>>> list(itertools.permutations(['1', '2', '3'], 2))
[('1', '2'), ('1', '3'), ('2', '1'), ('2', '3'), ('3', '1'), ('3', '2')]
>>> for a, b in itertools.permutations(['1', '2', '3'], 2):
... print(a+b)
...
12
13
21
23
31
32
>>> import itertools
>>> list(itertools.combinations(['1', '2', '3'], 2))
[('1', '2'), ('1', '3'), ('2', '3')]
import webbrowser
webbrowser.open_new('http://python.org')
webbrowser.open('http://python.org')
pip install SomePackage으로 설치pip install SomePackage==1.0.4 으로 특정 버전을 설치가능pip install --upgrade SomePackage으로 최신 버전 업그레이드 가능pip uninstall SomePackage으로 삭제
>>> from faker import Faker
>>> fake = Faker()
>>> fake.name()
'Matthew Estrada'
>>> fake = Faker('ko-KR')
>>> fake.name()
'김하은'
>>> fake.address()
'충청북도 수원시 잠실6길 (경자주이읍)'
