利用Python生成随机域名等随机字符串. #!/usr/bin/env python# -*- coding: utf-8 -*- from random import randrange, choice from string import ascii_lowercase as lc from sys import maxsize from time import ctime tlds = ('com', 'edu', 'net', 'org', 'gov') for i in range(
首先导包: import uuid uuid1(): # make a UUID based on the host ID and current time # 基于MAC地址,时间戳,随机数来生成唯一的uuid,可以保证全球范围内的唯一性 >>> uuid.uuid1() # doctest: +SKIP 结果:UUID('a8098c1a-f86e-11da-bd1a-00112444be1e') uuid3(): # make a UUID using an