Created
January 31, 2019 04:16
-
-
Save ezirmusitua/c1e605e2a5097af54336603e74df9635 to your computer and use it in GitHub Desktop.
[Convert csv string to array] Convert csv string to array in python with StringIO #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
# for Python 2.x | |
from StringIO import StringIO | |
except ImportError: | |
# for Python 3.x | |
from io import StringIO | |
import csv | |
scsv = """text,with,Polish,non-Latin,lettes | |
1,2,3,4,5,6 | |
a,b,c,d,e,f | |
gęś,zółty,wąż,idzie,wąską,dróżką, | |
""" | |
f = StringIO(scsv) | |
reader = csv.reader(f, delimiter=',') | |
for row in reader: | |
print('\t'.join(row)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment