I'm parsing a big csv file and I need to know how to remove commas from the parsed csv. I'm parsing it to html and I need like to know it there is a specific character at the line that was parsed but the document is full of commas, so it does not have a pattern, so how do I do it? I tried this
for line_number,line in enumerate(csv_file):
line.strip(",")
if line_number < 6:
continue
print(line)
csv_row = line.split("\t")
print(csv_row)
for col_num,entry in enumerate(csv_row):
#information always start on line 6
if len(entry) < 1:
continue
if entry[0] and entry[1] and entry[2] == "~":
html_text += "<div class = 'child_entries'>" + entry + "</div>"
if entry_count > 0:
html_text += "</div>"
#elif entry[1] == "~":
# print("aaaa")
# html_text += "<div class = 'child_entries'>" + entry + "</div>"
#if last_child_entry_column < col_num:
# html_text += '<div class="child_entries">'
html_text += '<div class="entry">'
#last_child_entry_column = col_num
entry_count +=1
html_text += '<div>' + entry + '</div>'
and tried using the re
library and got
AttributeError: 'str' object has no attribute 'write'
right now the parsed file looks like this
",,Description:a sequence of permission IDs from the backend global settings UserPermissions class.,,,,,,,,"
and the objective is like this
"Description:a sequence of permission IDs from the backend global settings UserPermissions class"
So, do you guys have any idea of how can I do it?