I am writing a short script to read 1000 names from a text file, with each name on its own line. I need to make every capital name, and then put an asterisk at the beginning and end. Like * JOHN DE. *. It happens that when he reads in a line, he retains the formatting, so every time before the last asterisk is added, it will go to the next line. Any thoughts? Thank you
def main(): infile=open("putNamesHere.txt","r") outfile=open("getFromHere.txt","w") for line in infile: line=line.upper() mystring=('*'+line+'*') outfile.write(mystring)
source share