我对python/代码并不熟悉,我正在寻求一些基本的帮助,从我认为是字典的东西中提取一些元素。所以我正在执行下面的操作。
print(data_quote)返回以下内容:
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
* RESPONSE: 218ms OK: [{'id': 1, 'name': 'Bitcoin', 'symbol': 'BTC', 'slug': 'bitcoin', 'num_market_pairs': 9506, 'date_added': '2013-04-28T00:00:00.000Z', 'tags': ['mineable', 'pow', 'sha-256', 'store-of-value', 'state-channels', 'coinbase-ventures-portfolio', 'three-arrows-capital-portfolio', 'polychain-capital-portfolio', 'binance-labs-portfolio', 'arrington-xrp-capital', 'blockchain-capital-portfolio', 'boostvc-portfolio', 'cms-holdings-portfolio', 'dcg-portfolio', 'dragonfly-capital-portfolio', 'electric-capital-portfolio', 'fabric-ventures-portfolio', 'framework-ventures', 'galaxy-digital-portfolio', 'huobi-capital', 'alameda-research-portfolio', 'a16z-portfolio', '1confirmation-portfolio', 'winklevoss-capital', 'usv-portfolio', 'placeholder-ventures-portfolio', 'pantera-capital-portfolio', 'multicoin-capital-portfolio', 'paradigm-xzy-screener'], 'max_supply': 21000000, 'circulating_supply': 18675393, 'total_supply': 18675393, 'platform': None, 'cmc_rank': 1, 'last_updated': '2021-04-06T21:17:02.000Z', 'quote': {'USD': {'price': 58324.48252140573, 'volume_24h': 65699187936.697296, 'percent_change_1h': -0.11815165, 'percent_change_24h': -1.30799467, 'percent_change_7d': -0.86713748, 'percent_change_30d': 16.89536691, 'percent_change_60d': 55.08996724, 'percent_change_90d': 68.97932129, 'market_cap': 1089232632608.8828, 'last_updated': '2021-04-06T21:17:02.000Z'}}}, {'id': 1027, 'name': 'Ethereum', 'symbol': 'ETH', 'slug': 'ethereum', 'num_market_pairs': 6188, 'date_added': '2015-08-07T00:00:00.000Z', 'tags': ['mineable', 'pow', 'smart-contracts', 'ethereum', 'coinbase-ventures-portfolio', 'three-arrows-capital-portfolio', 'polychain-capital-portfolio', 'binance-labs-portfolio', 'arrington-xrp-capital', 'blockchain-capital-portfolio', 'boostvc-portfolio', 'cms-holdings-portfolio', 'dcg-portfolio', 'dragonfly-capital-portfolio', 'electric-capital-portfolio', 'fabric-ventures-portfolio', 'framework-ventures', 'hashkey-capital-portfolio', 'kinetic-capital', 'huobi-capital', 'alameda-research-portfolio', 'a16z-portfolio', '1confirmation-portfolio', 'winklevoss-capital', 'usv-portfolio', 'placeholder-ventures-portfolio', 'pantera-capital-portfolio', 'multicoin-capital-portfolio', 'paradigm-xzy-screener'], 'max_supply': None, 'circulating_supply': 115361642.1865, 'total_supply': 115361642.1865, 'platform': None, 'cmc_rank': 2, 'last_updated': '2021-04-06T21:17:02.000Z', 'quote': {'USD': {'price': 2120.1707443094906, 'volume_24h': 29172611149.352947, 'percent_change_1h': -0.1523387, 'percent_change_24h': 0.57727077, 'percent_change_7d': 14.76712255, 'percent_change_30d': 29.55009273, 'percent_change_60d': 24.5531557, 'percent_change_90d': 86.25530334, 'market_cap': 244586378779.31683, 'last_updated': '2021-04-06T21:17:02.000Z'}}}, {'id': 1839, 'name': 'Binance Coin', 'symbol': 'BNB', 'slug': 'binance-coin', 'num_market_pairs': 576, 'date_added': '2017-07-25T00:00:00.000Z', 'tags': ['marketplace', 'centralized-exchange', 'payments', 'binance-smart-chain', 'alameda-research-portfolio', 'multicoin-capital-portfolio'], 'max_supply': 170532785, 'circulating_supply': 154532785, 'total_supply': 170532785, 'platform': None, 'cmc_rank': 3, 'last_updated': '2021-04-06T21:16:17.000Z', 'quote': {'USD': {'price': 405.0598935039566, 'volume_24h': 5135791169.576727, 'percent_change_1h': 2.4766722, 'percent_change_24h': 8.19191755, 'percent_change_7d': 32.6945233, 'percent_change_30d': 75.57514085, 'percent_change_60d': 541.98708005, 'percent_change_90d': 881.50573075, 'market_cap': 62595033434.96982, 'last_updated': '2021-04-06T21:16:17.000Z'}}}, {'id': 52, 'name': 'XRP', 'symbol': 'XRP', 'slug': 'xrp', 'num_market_pairs': 662, 'date_added': '2013-08-04T00:00:00.000Z', 'tags': ['medium-of-exchange', 'enterprise-solutions', 'binance-chain', 'arrington-xrp-capital', 'galaxy-digital-portfolio', 'a16z-portfolio', 'pantera-capital-portfolio'], 'max_supply': 100000000000, 'circulating_supply': 45404028640, 'total_supply': 99990831162, 'platform': None, 'cmc_rank': 4, 'last_updated': '2021-04-06T21:17:03.000Z', 'quote': {'USD': {'price': 1.04733959535835, 'volume_24h': 36929086490.79997, 'percent_change_1h': 3.6474961, 'percent_change_24h': 23.33977412, 'percent_change_7d': 84.65437298, 'percent_change_30d': 127.7463018, 'percent_change_60d': 137.07977162, 'percent_change_90d': 337.68047475, 'market_cap': 47553436983.456535, 'last_updated': '2021-04-06T21:17:03.000Z'}}}, {'id': 825, 'name': 'Tether', 'symbol': 'USDT', 'slug': 'tether', 'num_market_pairs': 11828, 'date_added': '2015-02-25T00:00:00.000Z', 'tags': ['store-of-value', 'payments', 'stablecoin', 'stablecoin-asset-backed', 'solana-ecosystem'], 'max_supply': None, 'circulating_supply': 42990752850.31685, 'total_supply': 43646290993.53494, 'platform': {'id': 1027, 'name': 'Ethereum', 'symbol': 'ETH', 'slug': 'ethereum', 'token_address': '0xdac17f958d2ee523a2206206994597c13d831ec7'}, 'cmc_rank': 5, 'last_updated': '2021-04-06T21:16:17.000Z', 'quote': {'USD': {'price': 1.00180954051279, 'volume_24h': 147105163700.08792, 'percent_change_1h': -0.00337412, 'percent_change_24h': 0.13043176, 'percent_change_7d': 0.1191329, 'percent_change_30d': 0.16099888, 'percent_change_60d': 0.16947024, 'percent_change_90d': 0.05326217, 'market_cap': 43068546359.27484, 'last_updated': '2021-04-06T21:16:17.000Z'}}}, {'id': 2010, 'name': 'Cardano', 'symbol': 'ADA', 'slug': 'cardano', 'num_market_pairs': 255, 'date_added': '2017-10-01T00:00:00.000Z', 'tags': ['mineable', 'dpos', 'pos', 'platform', 'research', 'smart-contracts', 'staking', 'binance-chain'], 'max_supply': 45000000000, 'circulating_supply': 31948309440.7478, 'total_supply': 45000000000, 'platform': None, 'cmc_rank': 6, 'last_updated': '2021-04-06T21:16:11.000Z', 'quote': {'USD': {'price': 1.25155454518986, 'volume_24h': 6269725512.213743, 'percent_change_1h': -2.07133508, 'percent_change_24h': 4.42214999, 'percent_change_7d': 2.4917662, 'percent_change_30d': 12.76515356, 'percent_change_60d': 134.01783531, 'percent_change_90d': 325.17673752, 'market_cap': 39985051891.70002, 'last_updated': '2021-04-06T21:16:11.000Z'}}}, {'id': 6636, 'name': 'Polkadot', 'symbol': 'DOT', 'slug': 'polkadot-new', 'num_market_pairs': 175, 'date_added': '2020-08-19T00:00:00.000Z', 'tags': ['substrate', 'polkadot', 'binance-chain', 'polkadot-ecosystem', 'three-arrows-capital-portfolio', 'polychain-capital-portfolio', 'blockchain-capital-portfolio', 'boostvc-portfolio', 'cms-holdings-portfolio', 'coinfund-portfolio', 'fabric-ventures-portfolio', 'fenbushi-capital-portfolio', 'hashkey-capital-portfolio', 'kinetic-capital', '1confirmation-portfolio', 'placeholder-ventures-portfolio', 'pantera-capital-portfolio'], 'max_supply': None, 'circulating_supply': 926243043.5634505, 'total_supply': 1062267157.0176383, 'platform': None, 'cmc_rank': 7, 'last_updated': '2021-04-06T21:17:05.000Z', 'quote': {'USD': {'price': 43.13745049794805, 'volume_24h': 3219936954.166115, 'percent_change_1h': 0.06857841, 'percent_change_24h': -1.95999633, 'percent_change_7d': 27.0018333, 'percent_change_30d': 28.41686344, 'percent_change_60d': 109.63967495, 'percent_change_90d': 338.72895952, 'market_cap': 39955763440.78709, 'last_updated': '2021-04-06T21:17:05.000Z'}}}, {'id': 7083, 'name': 'Uniswap', 'symbol': 'UNI', 'slug': 'uniswap', 'num_market_pairs': 228, 'date_added': '2020-09-17T00:00:00.000Z', 'tags': ['decentralized-exchange', 'defi', 'dao', 'yield-farming', 'amm', 'coinbase-ventures-portfolio', 'three-arrows-capital-portfolio', 'governance', 'blockchain-capital-portfolio', 'defiance-capital', 'alameda-research-portfolio', 'a16z-portfolio', 'pantera-capital-portfolio', 'parafi-capital', 'paradigm-xzy-screener'], 'max_supply': 1000000000, 'circulating_supply': 523256856.47115046, 'total_supply': 1000000000, 'platform': {'id': 1027, 'name': 'Ethereum', 'symbol': 'ETH', 'slug': 'ethereum', 'token_address': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'}, 'cmc_rank': 8, 'last_updated': '2021-04-06T21:16:11.000Z', 'quote': {'USD': {'price': 31.12928923765244, 'volume_24h': 568914709.7484151, 'percent_change_1h': 0.02767427, 'percent_change_24h': 0.43722838, 'percent_change_7d': 8.51145288, 'percent_change_30d': 0.51900684, 'percent_change_60d': 48.78864152, 'percent_change_90d': 409.23009991, 'market_cap': 16288614030.675232, 'last_updated': '2021-04-06T21:16:11.000Z'}}}, {'id': 2, 'name': 'Litecoin', 'symbol': 'LTC', 'slug': 'litecoin', 'num_market_pairs': 735, 'date_added': '2013-04-28T00:00:00.000Z', 'tags': ['mineable', 'pow', 'scrypt', 'medium-of-exchange', 'binance-chain'], 'max_supply': 84000000, 'circulating_supply': 66752414.51538747, 'total_supply': 66752414.51538747, 'platform': None, 'cmc_rank': 9, 'last_updated': '2021-04-06T21:17:02.000Z', 'quote': {'USD': {'price': 242.9633916548622, 'volume_24h': 9318409785.449207, 'percent_change_1h': 1.58679941, 'percent_change_24h': 11.0925692, 'percent_change_7d': 24.23189386, 'percent_change_30d': 31.49825467, 'percent_change_60d': 60.24127203, 'percent_change_90d': 51.72866252, 'market_cap': 16218393031.809793, 'last_updated': '2021-04-06T21:17:02.000Z'}}}, {'id': 1975, 'name': 'Chainlink', 'symbol': 'LINK', 'slug': 'chainlink', 'num_market_pairs': 489, 'date_added': '2017-09-20T00:00:00.000Z', 'tags': ['platform', 'defi', 'oracles', 'smart-contracts', 'substrate', 'polkadot', 'polkadot-ecosystem', 'solana-ecosystem', 'framework-ventures'], 'max_supply': 1000000000, 'circulating_supply': 417509556.43444455, 'total_supply': 1000000000, 'platform': {'id': 1027, 'name': 'Ethereum', 'symbol': 'ETH', 'slug': 'ethereum', 'token_address': '0x514910771af9ca656af840dff83e8264ecf986ca'}, 'cmc_rank': 10, 'last_updated': '2021-04-06T21:16:17.000Z', 'quote': {'USD': {'price': 34.37016617113642, 'volume_24h': 2808495199.288725, 'percent_change_1h': 1.68675913, 'percent_change_24h': 9.05688888, 'percent_change_7d': 22.63094934, 'percent_change_30d': 25.10625714, 'percent_change_60d': 31.84392867, 'percent_change_90d': 116.01508249, 'market_cap': 14349872832.689318, 'last_updated': '2021-04-06T21:16:17.000Z'}}}, {'id': 512, 'name': 'Stellar', 'symbol': 'XLM', 'slug': 'stellar', 'num_market_pairs': 335, 'date_added': '2014-08-05T00:00:00.000Z', 'tags': ['medium-of-exchange', 'enterprise-solutions', 'decentralized-exchange', 'smart-contracts', 'hashkey-capital-portfolio'], 'max_supply': 50001806812, 'circulating_supply': 22785681260.406754, 'total_supply': 50001803396.7887, 'platform': None, 'cmc_rank': 11, 'last_updated': '2021-04-06T21:17:06.000Z', 'quote': {'USD': {'price': 0.54033565169129, 'volume_24h': 5245142768.280184, 'percent_change_1h': 3.37469651, 'percent_change_24h': 7.14744287, 'percent_change_7d': 33.11473896, 'percent_change_30d': 33.55922282, 'percent_change_60d': 55.3151775, 'percent_change_90d': 91.57645886, 'market_cap': 12311915933.0719, 'last_updated': '2021-04-06T21:17:06.000Z'}}}, {'id': 1831, 'name': 'Bitcoin Cash', 'symbol': 'BCH', 'slug': 'bitcoin-cash', 'num_market_pairs': 579, 'date_added': '2017-07-23T00:00:00.000Z', 'tags': ['mineable', 'pow', 'sha-256', 'marketplace', 'enterprise-solutions', 'binance-chain'], 'max_supply': 21000000, 'circulating_supply': 18700881.25, 'total_supply': 18700881.25, 'platform': None, 'cmc_rank': 12, 'last_updated': '2021-04-06T21:16:09.000Z', 'quote': {'USD': {'price': 658.2993698785465, 'volume_24h': 5685814145.115592, 'percent_change_1h': 0.25032514, 'percent_change_24h': 6.63039386, 'percent_change_7d': 24.52915538, 'percent_change_30d': 30.08131641, 'percent_change_60d': 52.01052998, 'percent_change_90d': 52.10446019, 'market_cap': 12310778343.048525, 'last_updated': '2021-04-06T21:16:09.000Z'}}}, {'id': 2416, 'name': 'THETA', 'symbol': 'THETA', 'slug': 'theta', 'num_market_pairs': 51, 'date_added': '2018-01-17T00:00:00.000Z', 'tags': ['media', 'collectibles-nfts', 'content-creation', 'video', 'huobi-capital'], 'max_supply': 1000000000, 'circulating_supply': 1000000000, 'total_supply': 1000000000, 'platform': None, 'cmc_rank': 13, 'last_updated': '2021-04-06T21:17:05.000Z', 'quote': {'USD': {'price': 11.66543045119241, 'volume_24h': 365082525.14074886, 'percent_change_1h': -0.52342705, 'percent_change_24h': -0.62557224, 'percent_change_7d': -10.01162192, 'percent_change_30d': 179.28291648, 'percent_change_60d': 389.39405458, 'percent_change_90d': 456.27518714, 'market_cap': 11665430451.19241, 'last_updated': '2021-04-06T21:17:05.000Z'}}}, {'id': 2280, 'name': 'Filecoin', 'symbol': 'FIL', 'slug': 'filecoin', 'num_market_pairs': 112, 'date_added': '2017-12-13T00:00:00.000Z', 'tags': ['mineable', 'distributed-computing', 'filesharing', 'storage', 'polychain-capital-portfolio', 'blockchain-capital-portfolio', 'boostvc-portfolio', 'dcg-portfolio', 'hashkey-capital-portfolio', 'a16z-portfolio', 'winklevoss-capital', 'pantera-capital-portfolio'], 'max_supply': 2000000000, 'circulating_supply': 64698550, 'total_supply': 64698550, 'platform': None, 'cmc_rank': 14, 'last_updated': '2021-04-06T21:17:04.000Z', 'quote': {'USD': {'price': 166.96838010672514, 'volume_24h': 2475324138.941406, 'percent_change_1h': 0.37024939, 'percent_change_24h': -5.84434356, 'percent_change_7d': 14.1019259, 'percent_change_30d': 312.88250195, 'percent_change_60d': 556.35444044, 'percent_change_90d': 669.89462096, 'market_cap': 10802612088.753962, 'last_updated': '2021-04-06T21:17:04.000Z'}}}, {'id': 3408, 'name': 'USD Coin', 'symbol': 'USDC', 'slug': 'usd-coin', 'num_market_pairs': 886, 'date_added': '2018-10-08T00:00:00.000Z', 'tags': ['medium-of-exchange', 'stablecoin', 'stablecoin-asset-backed'], 'max_supply': None, 'circulating_supply': 10701284553.25657, 'total_supply': 10935302496.29955, 'platform': {'id': 1027, 'name': 'Ethereum', 'symbol': 'ETH', 'slug': 'ethereum', 'token_address': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'}, 'cmc_rank': 15, 'last_updated': '2021-04-06T21:17:05.000Z', 'quote': {'USD': {'price': 1.0016702670119, 'volume_24h': 1492667925.6445038, 'percent_change_1h': -0.00623742, 'percent_change_24h': 0.12119331, 'percent_change_7d': 0.13764092, 'percent_change_30d': 0.15185142, 'percent_change_60d': 0.18442668, 'percent_change_90d': 0.19390034, 'market_cap': 10719158555.83083, 'last_updated': '2021-04-06T21:17:05.000Z'}}}, {'id': 1958, 'name': 'TRON', 'symbol': 'TRX', 'slug': 'tron', 'num_market_pairs': 511, 'date_added': '2017-09-13T00:00:00.000Z', 'tags': ['media', 'payments'], 'max_supply': None, 'circulating_supply': 71659657369.49, 'total_supply': 100850743811.662, 'platform': None, 'cmc_rank': 16, 'last_updated': '2021-04-06T21:16:11.000Z', 'quote': {'USD': {'price': 0.12023377395961, 'volume_24h': 10666497577.898384, 'percent_change_1h': -1.38280983, 'percent_change_24h': -18.19901679, 'percent_change_7d': 83.5388578, 'percent_change_30d': 137.73408779, 'percent_change_60d': 235.99926728, 'percent_change_90d': 311.31508806, 'market_cap': 8615911046.186363, 'last_updated': '2021-04-06T21:16:11.000Z'}}}, {'id': 4256, 'name': 'Klaytn', 'symbol': 'KLAY', 'slug': 'klaytn', 'num_market_pairs': 31, 'date_added': '2020-03-30T00:00:00.000Z', 'tags': ['platform', 'enterprise-solutions'], 'max_supply': None, 'circulating_supply': 2448059130.2, 'total_supply': 10527368819.2, 'platform': None, 'cmc_rank': 17, 'last_updated': '2021-04-06T21:17:03.000Z', 'quote': {'USD': {'price': 3.43708080302498, 'volume_24h': 398613006.598883, 'percent_change_1h': -0.18651522, 'percent_change_24h': 3.98616401, 'percent_change_7d': -17.95950702, 'percent_change_30d': 116.85588005, 'percent_change_60d': 514.06987053, 'percent_change_90d': 650.84850594, 'market_cap': 8414177041.08045, 'last_updated': '2021-04-06T21:17:03.000Z'}}}, {'id': 3717, 'name': 'Wrapped Bitcoin', 'symbol': 'WBTC', 'slug': 'wrapped-bitcoin', 'num_market_pairs': 118, 'date_added': '2019-01-30T00:00:00.000Z', 'tags': ['medium-of-exchange', 'defi', 'stablecoin', 'stablecoin-asset-backed', 'wrapped-tokens'], 'max_supply': None, 'circulating_supply': 141602.84791701, 'total_supply': 141602.84791701, 'platform': {'id': 1027, 'name': 'Ethereum', 'symbol': 'ETH', 'slug': 'ethereum', 'token_address': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'}, 'cmc_rank': 18, 'last_updated': '2021-04-06T21:17:07.000Z', 'quote': {'USD': {'price': 58268.692973170684, 'volume_24h': 119328797.86432272, 'percent_change_1h': 0.163808, 'percent_change_24h': -0.93183652, 'percent_change_7d': -1.03181988, 'percent_change_30d': 16.24982113, 'percent_change_60d': 54.17252068, 'percent_change_90d': 68.24914656, 'market_cap': 8251012869.402837, 'last_updated': '2021-04-06T21:17:07.000Z'}}}, {'id': 74, 'name': 'Dogecoin', 'symbol': 'DOGE', 'slug': 'dogecoin', 'num_market_pairs': 312, 'date_added': '2013-12-15T00:00:00.000Z', 'tags': ['mineable', 'pow', 'scrypt', 'medium-of-exchange', 'memes', 'payments'], 'max_supply': None, 'circulating_supply': 129072700574.95102, 'total_supply': 129072700574.95102, 'platform': None, 'cmc_rank': 19, 'last_updated': '2021-04-06T21:17:03.000Z', 'quote': {'USD': {'price': 0.06148653027568, 'volume_24h': 2501156924.1030483, 'percent_change_1h': -0.0267709, 'percent_change_24h': 5.51264765, 'percent_change_7d': 14.18176769, 'percent_change_30d': 20.92946895, 'percent_change_60d': 33.56381468, 'percent_change_90d': 531.47468079, 'market_cap': 7936232511.665504, 'last_updated': '2021-04-06T21:17:03.000Z'}}}, {'id': 3077, 'name': 'VeChain', 'symbol': 'VET', 'slug': 'vechain', 'num_market_pairs': 122, 'date_added': '2017-08-22T00:00:00.000Z', 'tags': ['logistics', 'data-provenance', 'iot', 'smart-contracts', 'fenbushi-capital-portfolio'], 'max_supply': 86712634466, 'circulating_supply': 64315576989, 'total_supply': 86712634466, 'platform': None, 'cmc_rank': 20, 'last_updated': '2021-04-06T21:17:02.000Z', 'quote': {'USD': {'price': 0.113128687309, 'volume_24h': 1584710073.9041638, 'percent_change_1h': 2.45566548, 'percent_change_24h': 7.02819179, 'percent_change_7d': 26.82127317, 'percent_change_30d': 104.43460758, 'percent_change_60d': 271.60156874, 'percent_change_90d': 294.80711983, 'market_cap': 7275936798.286496, 'last_updated': '2021-04-06T21:17:02.000Z'}}}]
*/我在堆栈溢出和其他网站上搜索过,包括coinmarketcap文档(参考:https://coinmarketcap.com/api/documentation/v1/),但我不知道如何从data_quote中获取“名称”和“价格”。对我来说,这看上去像一本字典,但当我打印它时,它会返回这个(见下文),这会使我完全崩溃。
<class 'coinmarketcapapi.Response'>我试过这样的方法:
newlist = [d['name'] for d in data_quote]
print(newlist)但我明白了:
TypeError: 'Response' object is not iterable发布于 2021-04-07 21:14:58
因此,感谢我收到的夫妻评论,我发现我需要的是:
( a)查看非官方的coinmarketcap库API包装器(我正在使用的)- https://github.com/rsz44/python-coinmarketcap#response。
( b)在这里,它解释了响应是什么:是一个获得API结果的实例。此实例具有不同的属性,数据以字典的形式返回信息。
( c)在应用代码从Toby提供的dicts中提取代码时是这样的。
请参阅下面的完整答案(请注意,程序的第一部分,导入和登录键已经退出)
quote_data = quote.data
if quote.error != 0:
print (quote.error_code,quote.error_message)
else:
namelist = [d['name'] for d in quote_data]
print(namelist)
marketlist = [d['quote'] for d in quote_data]
pricelist = [d['USD'] for d in marketlist]
prices = [d['price'] for d in pricelist]
print(marketlist)
print(pricelist)
print(prices)
print("----------------------------")
print("Credits consumed:",quote.credit_count)发布于 2021-04-07 16:35:10
这个反应看上去基本上像一串白痴。因此,要提取名称(或其他键),只需进行列表理解:
[d['name'] for d in data_quote]
https://stackoverflow.com/questions/66990264
复制相似问题