#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
import random
import string
 
#第一种方法
 
seed = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=-"
sa = []
for i in range(8):
    sa.append(random.choice(seed))
salt = ''.join(sa)
print salt
 
#第二种方法
 
salt = ''.join(random.sample(string.ascii_letters + string.digits, 8))
print salt

 

相关文章:

  • 2021-12-03
  • 2022-12-23
  • 2018-07-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2023-02-14
  • 2022-12-23
  • 2021-07-03
  • 2021-12-09
  • 2021-07-02
  • 2021-10-06
相关资源
相似解决方案