DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
how to replace an element of a list using list comprehension
new_list = ["A" if element == "a" else element for element in a_list]
Source by www.kite.com #
PREVIOUS
NEXT
Tagged:
#replace
#element
#list
#list
#comprehension
ADD COMMENT
Topic
COMMENT
Name
9+7 =
Submit