小编lor*_*rde的帖子

Python - 使用2个值之间的数字创建列表?

如何创建一个列表,其中包含我输入的两个值之间的值?例如,为11到16的值生成以下列表:

list = [11, 12, 13, 14, 15, 16]
Run Code Online (Sandbox Code Playgroud)

python list

304
推荐指数
8
解决办法
87万
查看次数

如何将字符串列表转换为新列表,其中每个元素是其核心类型?

例如,

我有一份清单

list = ['1', 'hello', '524', '65.23']
Run Code Online (Sandbox Code Playgroud)

如何将其转换为:

list_new = [1, 'hello', 524, 65.23]
Run Code Online (Sandbox Code Playgroud)

其中每个元素不再是字符串,而是实际类型.

而不是[string,string,string,string]它现在是[int,string,int,float]

谢谢!

python types list type-conversion

2
推荐指数
1
解决办法
78
查看次数

标签 统计

list ×2

python ×2

type-conversion ×1

types ×1