how do i get python to print an invoice
Question: parts list array

    
    
    a =list(["CPU,$150.00","RAM ,$120.00","DVD drive $89.00","Hard Disk Drive,$189.99"])
    for letter in a:
        print(letter)
    

this is my parts list I am trying to figure out how to get it to print to a
printer any tips


Answer: From the python windows [print
tutorial:](http://timgolden.me.uk/python/win32_how_do_i/print.html)

    
    
    import win32api
    import win32print
    
    def parts_list():
       a = ["CPU,$150.00","RAM ,$120.00","DVD drive $89.00","Hard Disk Drive,$189.99"]
       with open('printfile.txt', 'w') as f:
            for line in a:
                f.write(line)
       print_windows('printfile.txt')
    
    def print_windows(filename):
        win32api.ShellExecute(0, "print", filename, '/d:"%s"' % winn32print.GetDefaultPrinter (),".",  0)
    
    def main():
        parts_list()
    
    if __name__ == '__main__':
        main()
    

