Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Фиксим CSV-файл
- broken_csv = open("broken.csv", "r")
- csv = broken_csv.read()
- broken_csv.close()
- csv = csv.replace(",", ".")
- csv = csv.replace("|", ",")
- csv = csv.replace(";REF#", "")
- csv = csv.replace("</span", "")
- csv = csv.replace("&", "")
- csv = csv.replace("id,name,a,b\n", "")
- csv = csv.replace("#", ".")
- csv = csv.replace(",", ".")
- # убираем точки в начале строк
- csv_lines = csv.split("\n")
- for line in csv_lines:
- line += "/n"
- for line in csv_lines:
- if line[0] == ".":
- line = line[1:]
- correct_csv = open("correct.csv", "w")
- correct_csv.writelines(csv_lines)
- correct_csv.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement