最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于python2.7實(shí)現(xiàn)圖形密碼生成器的實(shí)例代碼

 更新時(shí)間:2019年11月05日 09:08:45   作者:liumt  
本文通過實(shí)例代碼給大家介紹了python2.7實(shí)現(xiàn)圖形密碼生成器,代碼簡單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧

具體代碼如下所示:

#coding:utf8
import random,wx
def password(event):
  a = [chr(i) for i in range(97,123)]
  b = [chr(i) for i in range(65,91)]
  c = ['0','1','2','3','4','5','6','7','8','9']
  d = ['!','@','#','$','%','^','&','*','(',')','=','_','+','/','?']
  set1 = a + b + c + d
  set2 = a + b + c
  num = int(length.GetValue())
  if switch.GetValue() == 0:
    passwd = ''.join(random.sample(set1,num))
    contents.SetValue(passwd)
  else:
    passwd = ''.join(random.sample(set2,num))
    contents.SetValue(passwd)
app = wx.App()
win = wx.Frame(None,-1,title=u'密碼生成器',size=(480,200))
bkg = wx.Panel(win,-1)
# tt = wx.StaticText(bkg,-1,u'屏蔽輸入字符')
# delete = wx.TextCtrl(bkg,-1)
right = wx.Button(bkg,-1,label=u'確定生成')
right.Bind(wx.EVT_BUTTON,password)
stxt = wx.StaticText(bkg,-1,u'請輸入你的密碼長度位數(shù)!' )
length = wx.TextCtrl(bkg,-1,size=(50,27))
switch = wx.CheckBox(bkg, -1,u'關(guān)閉特殊字符',(150, 20))
sobx = wx.BoxSizer()
sobx.Add(stxt,proportion=0,flag=wx.ALL,border=5)
sobx.Add(length,proportion=1,border=5)
sobx.Add(switch,proportion=0,flag=wx.ALL | wx.ALIGN_RIGHT,border=5)
sobx.Add(right,proportion=0,flag=wx.EXPAND,border=5)
contents = wx.TextCtrl(bkg,-1)
cobx = wx.BoxSizer()
cobx.Add(contents,proportion=1,flag=wx.EXPAND,border=5)
dobx = wx.BoxSizer()
# dobx.Add(delete,proportion=1,flag=wx.ALL,border=5)
robx = wx.BoxSizer(wx.VERTICAL)
robx.Add(cobx,proportion=1,flag=wx.EXPAND | wx.ALL,border=5)
robx.Add(sobx,proportion=0,flag=wx.ALL,border=5)
# robx.Add(dobx,proportion=0,flag=wx.EXPAND,border=5)
bkg.SetSizer(robx)
win.Show()
app.MainLoop()

ps:下面看下python密碼生成器

'''
隨機(jī)密碼生成器
該生成器用于生成6位隨機(jī)密碼,包含A-Z, a-z , 0-9 , - + = @ $ % & ^
'''
import random
#定義密碼生成函數(shù)
def pass_generator(n):
  lst1 = list(range(65,91))
  lst2 = list(range(97,123))
  lst3 = list(range(10))
  lst4 = ['+','-','=','@','#','$','%','^']
  s1 = ''.join(chr(c) for c in lst1)
  s2 = ''.join(chr(c) for c in lst2)
  s3 = ''.join(str(i) for i in lst3)
  s4 = ''.join( c for c in lst4)
  s = s1 + s2 + s3 + s4
  p = ''
  for _ in range(n):
    p += random.choice(s)
  return p
print(pass_generator(32))

總結(jié)

以上所述是小編給大家介紹的python2.7實(shí)現(xiàn)圖形密碼生成器的實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

最新評(píng)論

白水县| 泸水县| 普定县| 扶沟县| 定州市| 康马县| 彰化市| 东山县| 诏安县| 平湖市| 张家港市| 镇雄县| 台中县| 轮台县| 德惠市| 丹江口市| 阜南县| 九龙城区| 呼伦贝尔市| 灵寿县| 那坡县| 沙坪坝区| 黄山市| 武川县| 白玉县| 海丰县| 栾川县| 新竹市| 巫溪县| 辽源市| 象州县| 衡阳市| 镇安县| 姜堰市| 芦溪县| 武平县| 屯昌县| 遂溪县| 金平| 湟中县| 柯坪县|