• UUID是根据MAC以及当前时间等创建的不重复的随机字符串
import uuid

# Generate a UUID from a host ID, sequence number, and the current time
>>> uuid.uuid1() # Generate a UUID from the MD5 hash of a namespace UUID and a name
>>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org') # Generate a random UUID
>>> uuid.uuid4() # Generate a UUID from the SHA-1 hash of a namespace UUID and a name
>>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org') # make a UUID from a string of hex digits(braces and hypens ignored)
>>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}') # convert a UUID to a string of hex digits in standard form
>>> str(x)

Python 之 UUID的更多相关文章

  1. Python之uuid模块

    UUID是128位的全局唯一标识符,通常由32字节的字符串表示. 它可以保证时间和空间的唯一性,也称为GUID,全称为: UUID —— Universally Unique IDentifier P ...

  2. 【Python】 uuid生成唯一ID

    uuid uuid是128位的全局唯一标识符(univeral unique identifier),通常用32位的一个字符串的形式来表现.有时也称guid(global unique identif ...

  3. python使用uuid库生成唯一id

    概述: UUID是128位的全局唯一标识符,通常由32字节的字符串表示. 它可以保证时间和空间的唯一性,也称为GUID,全称为: UUID -- Universally Unique IDentifi ...

  4. Python使用UUID库生成唯一ID(转)

    原文:http://www.cnblogs.com/dkblog/archive/2011/10/10/2205200.html 资料: Python官方Doc:<20.15. uuid — U ...

  5. python中uuid来生成机器唯一标识

    摘要: 我们可以使用uuid1的后16位来标识一个机器.  # use machine specific uuid, last 16 char will be the same if machine ...

  6. python之UUID

    #!/usr/bin/python # -*- coding: UTF- -*- import uuid ''' uuid1():这个是根据当前的时间戳和MAC地址生成的,最后的12个字符408d5c ...

  7. [py]Python使用UUID库生成唯一ID(uuid模块)

    https://www.cnblogs.com/dkblog/archive/2011/10/10/2205200.html uuid介绍 UUID是128位的全局唯一标识符,通常由32字节的字符串表 ...

  8. python模块uuid产生唯一id

    使用版本4:uuid4就可以了 UUID4缺点:糟糕的随机数发生器使得它更有可能发生碰撞,但是概率真的很小 UUID1缺点:暴露隐私 If all you want is a unique ID, y ...

  9. python 使用UUID库生成唯一ID

      首先导包: import uuid   uuid1(): # make a UUID based on the host ID and current time     #  基于MAC地址,时间 ...

随机推荐

  1. Mac OS下配置PHP Nginx PHP-FPM

    首先需要安装homebrew, 不赘述了 php-fpm php-fpm是mac下自带的软件, 而且兼容不同的PHP版本, 不用额外安装, 但是fpm是需要配置的, 在/private/etc下有个模 ...

  2. win32之取画刷的方法

    取画刷(HBRUSH) 的六种方法2009-- :00HBRUSH hbr; 第一种: hbr= CreateSolidBrush(RGB(,,)); //单色的画刷 第二种: hbr= (HBRUS ...

  3. Makefile 9——为依赖关系文件建立依赖关系

    现在我们再对complicated项目做一些更改,增加程序文件间依赖关系的复杂度. /× main.c ×/ #include"foo.h" int main(void) { fo ...

  4. node js 调试出现同一个端口启动多次报错处理方案 Error: listen EADDRINUSE

    windows 下 1.查询端口占用的进程ID: netstat -aon | findstr "80"    80为端口号, 输出为: TCP    0.0.0.0:3000   ...

  5. c#省市联动(sqlHelper的应用)

    sqlHelper: using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...

  6. mof提权原理及其过程

    mof提权的原理: mof是windows系统的一个文件(在c:/windows/system32/wbem/mof/nullevt.mof)叫做"托管对象格式"其作用是每隔五秒就 ...

  7. udacity android 实践笔记: lesson 4 part b

    udacity android 实践笔记: lesson 4 part b 作者:干货店打杂的 /titer1 /Archimedes 出处:https://code.csdn.net/titer1 ...

  8. xampp默认项目文件夹htdocs

    正确安装好XAMPP后,默认是必须将php程序放到 xampp\htdocs文件夹下才能运行但可以修改.. 参考:http://zhidao.baidu.com/link?url=sY_DPSeGBA ...

  9. Windows远程访问OEM乱码解决

    问题描述 发现用Windows访问Linux安装的Oracle时oem按钮总是乱码,整理解决方法如下: OEM简介及按钮乱码问题  http://www.linuxidc.com/Linux/2013 ...

  10. ChemDraw使用不了怎么办

    ChemDraw作为一款专业级的化学绘图软件,不仅可以帮助用户绘制图像在数据计算方面也起了很大作用,因此,ChemDraw非常受用户的欢迎.但是我们在使用过程中难免会遇到各种问题,特别是对于新手用户, ...