#usernames2.py #Sharon Persinger #This program creates a file of usernames from a file of names. #A username is the first letter of the first name follwed by #the first 7 letters of the last name. #This version reads the file a line at a time and processes the line. def main(): #open the input file and read the lines into a list infile = open("names20.txt", 'r') #open the output file outfile = open("users2.txt", 'w') for eachline in infile: first, last = eachline.split() #break into first and last names u = first[0] + last[0:7] #create the user name print(u, file = outfile) #print the user name to the output file infile.close() outfile.close() main()