开发者

How can I see if a child exists in Python?

I have an lxml object called item and 开发者_运维问答it may have a child called item.brand, however it's possible that there is none as this is returned from an API. How can I check this in Python?


Try hasattr().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜