社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Nihal  »  全部回复
回复总数  2
3 年前
回复了 Nihal 创建的主题 » 包中的git依赖项。json错误与“拒绝访问(公钥)”?

我使用了带有凭据的https repo URL,它成功了。

谢谢你的回答。

6 年前
回复了 Nihal 创建的主题 » 在Python3.x中查找数组是否存在且不为空

使用 isinstance() 要检查类型,它将返回布尔值

y = {
    "attributes": [
        {
            "name": "test"
        }
    ]
}

# p2 = json.dumps(y)

if 'attributes' not in y:
    print("not found")

else:
    print(y['attributes'])
    print(isinstance(y['attributes'], list))
    if isinstance(y['attributes'], list):
        print('its a list')
        print(len(y['attributes']))
    print("found")

输出:

[{'name': 'test'}]
True
its a list
1
found