My code is clearly messed up but several tries have led me nowhere. I created a custom dialect as such...
def wereofftoseesv(start_id, end_id):
with open('nba_2015_16_pbp.csv', "w") as f:
csv.register_dialect('scraper', delimiter="[", lineterminator = '', escapechar='', quoting=csv.QUOTE_MINIMAL)
writer = csv.writer(f, dialect='scraper')
writer.writerows(["gameid", "time_remaining", "entry", "score", "team", "line", "attendance + capacity", "refs"])
writer.writerows(list_cleaner(start_id, end_id))
I thought what this meant is that every time the CSV writer saw a "[" in my code, is would send the output that follows into a new cell.
The final code that I want to send to the CSV looks as such...
[[400827889], [([48, 0], 'Timofey Mozgov vs. Pau Gasol (Derrick Rose gains possession)', '0 - 0', 'CHI')], ['CHI -1.5'], ['Attendance: 21,957', 'Capacity: 20,917'], ['Mark Ayotte, Scott Foster, Ben Taylor'], [400827889], [([47, 34],
And I would like a new line with all those smaller lists and strings split every time you see the long number "400827889".
At current, my variable names (line 5) are showing up as follows:
g[a[m[e[i[d] t[i[m[e[_[r[e[m[a[i[n[i[n[g] e[n[t[r[y] s[c[o[r[e] t[e[a[m] l[i[n[e] a[t[t[e[n[d[a[n[c[e[" "[+[" "[c[a[p[a[c[i[t[y] r[e[f[s]
And my CSV outputs, with "//" being a post-facto addition by me to represent "new cell", are as follows:
"[400827888]"["[([48 // 0] // 'Andre Drummond vs. Al Horford (Ersan Ilyasova gains possession)'// '0 - 0' // 'ATL')]"["['ATL -6.5']"["['Attendance: 19 // 187' // 'Capacity: 18 // 729']"["['Eli Roe // Zach Zarba // Michael Smith']"["[400827888]"["[([47..."
Thanks for any and all help!