Python Find username in File

from random import choice

from tkinter.filedialog import askopenfilename, asksaveasfilename


file = open('names.txt', 'r')

outfile = open('unsernames.txt', 'a')


for myName in file.readlines():

    names = myName.rstrip().split(' ')

    

    first, last = names[0], names[1]

    

    adjectives = [' Scared', 'Scrappy', 'Silly', 'Studious', 'Risky', ' little', 'Savior', 'Stupid']


    adjSel = choice(adjectives)

    username = first + last + 'the' + adjSel

    

    print(f'Your username is {username}')

    print(username, file=outfile)

    

file.close()

outfile.close()


0 Kudos

Comments

Displaying 0 of 0 comments ( View all | Add Comment )