Fork me on GitHub

Alex Addnames

by Alexander Harding

30 Sep 2013

My Code

What follows is my python code which allows the user to add their own list of names and choose a file name to write out to.

def add_names(list_of_names, file):
  names_file = open(file, 'a')
  for name in list_of_names:
    print >> names_file, name
  names_file.close()


new_names = input('Type a list of names. ')
file_name = input('Type a file name ')+'.txt'
add_names(new_names,file_name)
print 'This program created '+str(file_name)+' in your home directory.'
Alex is a second year MSIS student at SILS and the bottom of the totem pole in the UNC Libraries IT Systems department. He looks forward to working with everyone in this class! Find Alexander Harding on Twitter, Github, and on the web.
comments powered by Disqus