Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import random
- import string
- dataFile = open ("useraccounts.csv", "r")
- reader = csv.reader(dataFile)
- dataFile.readline()
- for row in reader:
- # Ignore those blank lines
- if not ''.join(row).strip():
- continue
- firstName = row[0]
- secondName = row[1]
- # Skip any line with missing entries
- if firstName == "":
- continue
- if secondName == "":
- continue
- # For the rest, create a user name out of the initial of the firstname followed by the surname, all in lowercase
- else:
- userName = firstName[0].lower() + secondName.lower()
- password = ''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(16))
- print ("Firstname: " + firstName +
- "\nSurname: " + secondName +
- "\nUsername: " + userName +
- "\nPassword: " + password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement