336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
랜덤함수
1) random
1) random
>>> import random >>> import string >>> c = string.letters + string.digits >>> c 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' >>> v = ''.join(random.sample(c, 6)) >>> v 'yxEeLl'2) uuid
>>> import uuid >>> uuid.uuid1() UUID('8f9f01b8-923e-11e0-889b-1093e9020660') >>> str(uuid.uuid1()) '98c3d57a-923e-11e0-ae95-1093e9020660' >>> uuid.uuid4() UUID('6a81a0ca-dcfc-4024-883e-5abb29238b4d') >>> str(uuid.uuid4()) '7ed3f7b9-84a5-4066-8e9c-e5e1bc370573' >>> str(uuid.uuid4()).replace("-", "") '7ed3f7b984a54066-8e9ce5e1bc370573'3) os
>>> import os >>> import binascii >>> os.urandom(16) 'h\xb4\xaa<\x12\xa5\xc8\xaf\xa2sCr\x93\x01f\xdc' >>> binascii.hexlify(os.urandom(16)) '7a26ada27ace29eb422c04efe7313526' >>> int(binascii.hexlify(os.urandom(16)), 16) 69812220901636122490437131090184792388L4) 기타
>>> random.random() 0.37444887175646646 >>> random.uniform(1, 10) 1.1800146073117523 >>> random.randint(1, 10) 7 >>> random.randrange(0, 101, 2) 26 >>> random.choice('abcdefghij') 'c' >>> items = [1, 2, 3, 4, 5, 6, 7] >>> random.shuffle(items) >>> items [7, 3, 2, 5, 6, 4, 1] >>> random.sample([1, 2, 3, 4, 5], 3) [4, 1, 5]
'Analysis > Python' 카테고리의 다른 글
[Python] wmi (0) | 2016.08.10 |
---|---|
[Python] with, seek, tell (0) | 2016.08.03 |
Python 리스트(배열) (0) | 2016.07.05 |
base64로 인코딩된 바이너리 파일 확인 (0) | 2016.03.31 |