import re def split_csv(string): return [row.split(",") for row in string.splitlines()] def strip_quotes(string): strip_regex = re.compile(r'("?)*$("?)') search = strip_regex.search(string) if search: return search.group(1) else: return None