所以我一直在通过python与trelloapi交互。 当我得到我的卡片时,它会返回(除其他外)这个列表(将它转换成JSON表示漂亮)
{
"cards": [
{
"id": "censored",
"checkItemStates": null,
"closed": false,
"dateLastActivity": "2017-03-13T20:31:15.161Z",
"desc": "",
"descData": null,
"idBoard": "censored",
"idList": "censored",
"idMembersVoted": [
],
"idShort": 1,
"idAttachmentCover": null,
"manualCoverAttachment": false,
"idLabels": [
],
"name": "testcard1",
"pos": 65535,
"shortLink": "censored",
"badges": {
"votes": 0,
"viewingMemberVoted": false,
"subscribed": false,
"fogbugz": "",
"checkItems": 0,
"checkItemsChecked": 0,
"comments": 0,
"attachments": 0,
"description": false,
"due": null,
"dueComplete": false
},
"dueComplete": false,
"due": null,
"email": "censored",
"idChecklists": [
],
"idMembers": [
],
"labels": [
],
"shortUrl": "censored",
"subscribed": false,
"url": "censored",
"attachments": [
],
"pluginData": [
]
}
]
}
我试过了
for card in x.cards:
print "hi"
但它给了我这个错误
AttributeError: 'list' object has no attribute 'cards'
我的最终目标是获得每个“name”属性并将其打印到txt文件中(我知道如何将内容写入.txt文件)
在最后的结果,会有更多的thn 1卡ofc。你知道吗
看起来Java开发人员同意您的意见,即
generate
应该接受Supplier<? extends T>
,因为它在Java 9中被更改了。见JDK-8132097 (Stream.generate should use a covariant Supplier as parameter):这种改变是有意义的,因为做了这样的事情:
应该完全有效。诚然,这是一个非常做作的例子,但重点是:
Supplier
应该允许用T
的任何子类型进行参数化。与PEC相关的是Supplier
是T
的产生者相关问题 更多 >
编程相关推荐