We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4827c8c + 13c83c0 commit 6f5ee8aCopy full SHA for 6f5ee8a
clang/test/Analysis/csv2json.py
@@ -44,7 +44,7 @@ def csv_to_json_dict(csv_filepath):
44
"""
45
try:
46
with open(csv_filepath, "r", encoding="utf-8") as csvfile:
47
- reader = csv.reader(csvfile)
+ reader = csv.reader(csvfile, skipinitialspace=True)
48
49
# Read the header row (column names)
50
@@ -58,12 +58,13 @@ def csv_to_json_dict(csv_filepath):
58
json.dumps({}, indent=2)
59
return
60
61
- other_column_names = [name.strip() for name in header[1:]]
+ header_length = len(header)
62
+ other_column_names = header[1:]
63
64
data_dict = {}
65
66
for row in reader:
- if len(row) != len(header):
67
+ if len(row) != header_length:
68
raise csv.Error("Inconsistent CSV file")
69
exit(1)
70
0 commit comments