Last active
December 16, 2015 05:58
-
-
Save nanmo/5387691 to your computer and use it in GitHub Desktop.
http://d.hatena.ne.jp/nullpobug/20070703/1183428670 のargparse使った版
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import argparse | |
parser = argparse.ArgumentParser(description='Generate random characters from specified length/lines.') | |
parser.add_argument('length', help='length of line', type=int ) | |
parser.add_argument('number', help='number of lines', type=int ) | |
args = parser.parse_args() | |
passlen = args.length | |
count = args.number | |
s = 'abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789' | |
for i in range(count): | |
password = '' | |
for j in range(passlen): | |
password += random.choice(s) | |
print password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment