python生成1-999随机数 指定个数

版权声明:皆为本人原创,复制必究 https://blog.csdn.net/m493096871/article/details/86560108

import random
mydict={}
c=0
while len(mydict.keys()) <100:
    mydict["6102009%03d"%(random.randint(1,100))]="redhat"
print("account    password")
for i,j in mydict.items():
    print(i,j)
account={}.fromkeys(mydict,"redhat")
print(account)
print({i:j for i,j in mydict.items()})  一行打印出来

猜你喜欢

转载自blog.csdn.net/m493096871/article/details/86560108