Remove characters left of first Space

#! py35
# open file, process, and save output to new file

stdin
= r'C:projectstxt.txt'
stdout = r'C:projectstext.csv'



with open(stdin, 'r', encoding='utf-8') as f:  # open input file
    lines = f.readlines()                      # iterate one line at time
    for line in lines:                          # for each line
        l = line.split(' ', 1)[1]               # remove left of first space
        with open(stdout, 'a') as fout:         # open output file
            fout.write(l)                       # write line to output file
                 

Leave a Reply

Your email address will not be published. Required fields are marked *