If a string either follow this format such as 'a,b,c,d'
(where a
,b
,c
,d
are all int
) or completely empty.
For example:
179,170,271,83
null
143,406,299,44
145,403,299,44
142,404,299,44
31,450,337,36
null
90,269,242,32
87,266,244,35
null
272,251,223,119
27,40,316,10
How can I store the value of a
,b
,c
,d
?
I tried using the split comma and check for empty string, but it doesn't help
if string:
txt = string.split(',')
height = txt[0]
left = txt[1]
top = txt[2]
width = txt[3]
else:
height = ""
left = ""
top = ""
width = ""