mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-12-23 03:02:53 +01:00
python/pin.py: modularize
This commit is contained in:
parent
c88e99a067
commit
bbaf5778ef
@ -6,14 +6,26 @@ length.
|
|||||||
import secrets
|
import secrets
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
This is where the magic happens.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
wantedCount = int(sys.argv[1])
|
desired_length = int(sys.argv[1])
|
||||||
except IndexError as noarg:
|
except IndexError:
|
||||||
print("Enter a digit as an argument!")
|
print("Enter a digit as an argument!")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for i in range(int(wantedCount)):
|
for i in range(int(desired_length)):
|
||||||
print(secrets.randbelow(10), end="")
|
print(secrets.randbelow(10), end="")
|
||||||
except NameError as noWantedCount:
|
# We satisfy pylint by having the variable here.
|
||||||
|
# TODO:make this a while loop?
|
||||||
|
i += 1
|
||||||
|
except NameError:
|
||||||
print()
|
print()
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user