Hi
Hoping someone can help. I am trying to convert a txt file (hundred of lines)- (sample below)
pc_account = An account is an entity (person or company) that applies for or purchases one or more policies from the carrier. Account attributes include years in business, industry code (SIC, NAICS, etc)
By splitting the file into an CSV file that parses out the file into columns by the '=' exist
I have something like this:
thanks in advance for your time.
Hoping someone can help. I am trying to convert a txt file (hundred of lines)- (sample below)
pc_account = An account is an entity (person or company) that applies for or purchases one or more policies from the carrier. Account attributes include years in business, industry code (SIC, NAICS, etc)
By splitting the file into an CSV file that parses out the file into columns by the '=' exist
I have something like this:
import csv with open('S:\descriptions.txt', 'r') as in_file: stripped = (line.strip() for line in in_file) lines = (line.split("=") for line in stripped if line) with open('S:\log.csv', 'w') as out_file: writer = csv.writer(out_file) writer.writerow(('title', 'Defn')) writer.writerows(lines)Any help is appreciated
thanks in advance for your time.
Larz60+ write Dec-07-2020, 09:40 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time, please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time, please use bbcode tags on future posts.