Think before you speak, read before you think.

python map函数对list转换

results = [‘1’, ‘2’, ‘3’]
变为
results = [1, 2, 3]

使用

results = map(int, results)

反过来转换使用

results = map(str, results)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *