1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

パスワードジェネレーター 改良版

Posted at
pwj.py
# coding: utf-8;

# パスワードジェネレーター ver1.0 (数字 アルファベット小文字大文字混合)
import random
import re

print("何ケタのパスワードにしますか?")

num = list(range(10))

eng = "abcdefghijklmnopqrstuvwxyz"
ENG = list(str(eng)+str(eng.upper()))

pw = num + ENG

user_select = int(input())
number = random.sample(pw, user_select)        # 数字リスト  

dic =str.maketrans("", "", " ,'")              # 置換する文字が少ない場合はreplaceで対応可。後の変更を想定してtranslate()関数使用。

pwd = str(number).translate(dic)
print(pwd)

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?