如何在Python中生成人类友好的唯一ID? [英] How to generate a human friendly unique ID in Python?

查看:100
本文介绍了如何在Python中生成人类友好的唯一ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何生成一个唯一的ID值,该值可以轻松地通过电话或电子邮件传递,可以轻松记住而又不容易被猜中.

How do I generate a unique ID value that can be easily passed on via phone or email, that can be easily remembered while still not being easily guessable.

我正在使用数据库.但是,当我将ID赠送给人们时,我不想将其绑定到数据库.我可以使用已经在数据库中拥有的唯一ID进行某事,但是不能直接使用它,以避免它容易被猜到.

I am using database. But as I am giving away the ID to people I do not want it to be bound to a database. I could do something with the unique ID I already have in database, but cannot use it directly, to avoid it being guessable.

我正在使用Python,并尝试使用uuid,但是uuid 时间太长,难以被人阅读.

I am using Python and have tried using uuid, but uuid is too long to be human readable.

有什么方法可以创建人类友好的可发音ID?

推荐答案

您想要做的是将音节缝合在一起以创建可发音的伪单词.您可以用任何您喜欢的语言创建音节,以组成可以发音并可以传达但实际上没有任何意义的单词.

What you want to do is stitch together syllables to create pronounceable pseudo words. You can create syllables in any language you like to make up words that can be pronounced and communicated but don't actually mean anything.

此处是有关一个人如何创建人类可读的UID并以语音方式发音的文章以及一些陷阱.

请阅读上面的链接,以了解在采用这种方法时应考虑的一些陷阱.

Read the above link for just some of the pitfalls you should consider when taking an approach like this.

您可以只使用一串字母,但可以将它们显示为北约注音字母只是字母.

You could just use a string of alphabetic letters but present them as the NATO phonetic alphabet instead of just the alphabet.

这篇关于如何在Python中生成人类友好的唯一ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆