我有以下代码:
if( capabilities is None ):
capabilities = get_capabilities_specific(region=region,param=param,logger=logger)
logger.error("Capabilities type : %s", type(capabilities))
if( "Z_PT" in capabilities[-1] ):
日志为:
Capabilities type : <type 'list'>
错误是:
IndexError: list index out of range
是否存在一种检查功能[-1]是否存在的方法? And why check for capabilitites[-1]
?提前谢谢。我是python的新手。