Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in_file = 'dados_limpos_2018.csv'
- out_file = 'dados_2018.csv'
- output = open(out_file, 'w')
- with open(in_file, 'r') as source:
- for line in source:
- # split by semicolon
- data = line.strip().split(';')
- # remove all quotes found
- data = [t.replace('"','') for t in data]
- for item in data[:-1]:
- item.replace(',', '')
- output.write(''.join(['', item, '',',']))
- # write the last item separately, without the trailing ';'
- output.write(''.join(['"', item, '"']))
- output.write('n')
- output.close()
- name, number, sgUF, txtDescricao, year
- Romario, 15, RJ, Consultoria, 2018
- Ronaldo, 9, RJ, Logistics, Search and Support, 2018
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement