Created
January 9, 2020 19:23
-
-
Save travis23/8131579a52e2790e65c58dd9e9377600 to your computer and use it in GitHub Desktop.
[Read csv with Python] #python #csv #null
This file contains 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
# See https://stackoverflow.com/questions/7894856/line-contains-null-byte-in-csv-reader-python | |
with open(path_to_csv_file) as f: | |
reader = csv.reader((x.replace('\0', '') for x in f), delimiter=',') # Handle null values | |
while True: | |
try: | |
line = next(reader) | |
except StopIteration: | |
break | |
print(line) # process lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment