Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python replace string with int in list

>>> l= ['X','X',52,39,81,12,'X',62,94]
>>>
>>> l = list(map(lambda x:0 if x=="X" else x,l))
>>> l
[0, 0, 52, 39, 81, 12, 0, 62, 94]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #replace #string #int #list
ADD COMMENT
Topic
Name
7+6 =