Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

csv from string python

csv_string = """a,b,c
d,e,f
g,h,i
"""

lines = csv_string.splitlines()
print(lines)
OUTPUT
['a,b,c', 'd,e,f', 'g,h,i']

reader = csv.reader(lines)
parsed_csv = list(reader)

print(parsed_csv)
OUTPUT
[['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']]
Source by www.adamsmith.haus #
 
PREVIOUS NEXT
Tagged: #csv #string #python
ADD COMMENT
Topic
Name
8+1 =