A list with elements :
mylist = [3,7,8,9,2,4,6]
just wanted to change all its value to true
mylist = [True,True,True,True,True,True,True]
i can do it with for loop.
wanted to do in pythonic way preferably one liner
you can use lambda
with map
function
In [11]: mylist = [3,7,8,9,2,4,6]
#python 2.7
In [12]: mylist = map(lambda x: True,mylist)
#python 3.x
In [12]: mylist = list(map(lambda x: True,mylist))
In [13]: mylist
Out[13]: [True, True, True, True, True, True, True]