From ff8477224096d7c6998c194d72888e7d40d6885d Mon Sep 17 00:00:00 2001 From: YaYaB Date: Tue, 5 Jun 2018 16:05:45 +0200 Subject: [PATCH] Remove null values in list --- json_to_csv/json_to_csv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/json_to_csv/json_to_csv.py b/json_to_csv/json_to_csv.py index 4ae4ee1..cfc918b 100644 --- a/json_to_csv/json_to_csv.py +++ b/json_to_csv/json_to_csv.py @@ -73,9 +73,11 @@ def _flatten(d, parent_key='', sep='_', int_to_float=False): elif isinstance(w, str): my_elems.append('"' + w + '"') continue - else: + elif w != None: my_elems.append(w) continue + else: + continue # Put in in alphabetical order my_elems_w = sorted(my_elems_w, key=lambda tup: tup[0])