标签:for ESS lenovo 使用 pre res user connect rand
取一万个随机数,插入数据库
import random import psycopg2 import string conn=psycopg2.connect(database=‘postgres‘,user=‘postgres‘,password=‘postgres‘,host=‘192.168.137.3‘) cur=conn.cursor() # print(ran_str,type(ran_str)) for i in range(10000): ran_str = ‘‘.join(random.sample(string.ascii_letters + string.digits, 8)) #生成8位的随机数,包含大小写字母和数字 ran_str = ran_str + ‘@lenovo.com‘ # cur.execute("insert into test8 values(pgp_sym_encrypt(‘%s‘,‘abc‘,‘cipher-algo=aes256, compress-algo=0, compress-level=9‘))"%(ran_str)) cur.execute("insert into test10 values(encrypt(‘%s‘,‘aa@ghilkjds*dfjMTR‘,‘aes-128‘))" %(ran_str)) conn.commit() cur.close() conn.close()
标签:for ESS lenovo 使用 pre res user connect rand
原文地址:https://www.cnblogs.com/mmyy-blog/p/11643536.html