SyntaxFix
Write A Post
Hire A Developer
Questions
A ternary will suffice. change:
gotdata = dlist[1]
to
gotdata = dlist[1] if len(dlist) > 1 else 'null'
this is a shorter way of expressing
if len(dlist) > 1: gotdata = dlist[1] else: gotdata = 'null'