【发布时间】:2019-10-25 06:47:39
【问题描述】:
如果字符串遵循这种格式,例如'a,b,c,d'(其中a、b、c、d 都是int)或完全为空。
例如:
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
如何存储a,b,c,d 的值?
我尝试使用分隔逗号并检查空字符串,但没有帮助
if string:
txt = string.split(',')
height = txt[0]
left = txt[1]
top = txt[2]
width = txt[3]
else:
height = ""
left = ""
top = ""
width = ""
【问题讨论】:
-
您如何阅读您的输入?您可以从输入中发布非空字符串和空字符串的示例吗?
-
你真的有空行以及包含字符串
null的行吗?
标签: python indexoutofboundsexception