map を使ってみる (Python)
Python
Published: 2021-05-01

確認環境

$ python --version
Python 3.6.2 :: Anaconda custom (64-bit)

調査

test.py

a = ['1', '2', '3']
print(type(a[0]))

a[0] = int(a[0])
print(type(a[0]))

print('---')
b = ['4', '5']

c = map(int, b)
print(c)
c = list(c)
print(c)

出力結果

$ python test.py
<class 'str'>
<class 'int'>
---
<map object at 0x102790780>
[4, 5]

参考