小编A. *_*res的帖子

Python - 将值存储在一个for循环中的数组中

我想将每个价格值存储在一个数组中,从dict中获取它.我是一个新鲜的蟒蛇,我花了几个小时试图弄明白...

for item in world_dict:
     if item[1] == 'House':
       price = float(item[2])
       print p

The output is like:
200.5
100.7
300.9
...
n+100
Run Code Online (Sandbox Code Playgroud)

但是,我想以这种格式存储它:[200.5,100.7,300.9,...,n + 100]

python string for-loop

1
推荐指数
1
解决办法
4万
查看次数

标签 统计

for-loop ×1

python ×1

string ×1