csv - Python rstrip() doesn't work -
so have script (python: openpyxl outputs "none" empty cells) converts xlsx file csv file.
one of cells on multiple lines , contains no double quotes. when run rstrip() still remains on multiple lines
any ideas?
for rownum in sh.iter_rows(): values = [("" if cell.value none else unicode(cell.value).encode('ascii','ignore').rstrip()) cell in rownum] wr.writerow(values)
the first line in csv file is:
"s. no","summary","question","answer","keywords","product","category","access level (everyone, help, platinum)","status public (customer facing) private (internal only)"
how last cell
rstrip() remove whitespace @ end of string not newlines in middle of strings. following instead: lets variable values contains string, then:
values = ' '.join(values.strip().split('\n'))
Comments
Post a Comment