Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to replace number in list python

>>> numbers = [1 , 2, 3, 4, 4, 6] # a normal python list 
>>> numbers[4] = 5 # replace the redundant item (5th item) 
>>> numbers 
[1, 2, 3, 4, 5, 6] 
Comment

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]
Comment

PREVIOUS NEXT
Code Example
Python :: compilation terminated. In file included from plugins/python/pyloader.c:1:0: plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory #include <Python.h 
Python :: read data from gooogle cloud storage 
Python :: python save image pytelegrambotapi 
Python :: modules in python 
Python :: python string: .lower() 
Python :: how to do merge sort in python 
Python :: telegram.ext 
Python :: import pycocotools._mask as _mask error Expected 80, got 88 
Python :: webdriver python get total number of tabs 
Python :: Python Alphabet using list comprehension 
Python :: heading none in pandas import 
Python :: ValueError: Please provide a TPU Name to connect to. site:stackoverflow.com 
Python :: python logging silent 
Python :: python vs java 
Python :: import csv as dic 
Python :: request login python 
Python :: get processor model in python 
Python :: argsort in descending order numpy 
Python :: find rules of decision tree python 
Python :: where is a package stored python 
Python :: how to find pdf file in link beautifulsoup 
Python :: flask or django 
Python :: django trigger when an instance od data is deleted from model 
Python :: crawling emails with python 
Python :: group a dataset 
Python :: change index function for class python 
Python :: how to send image to template thats not in static flask 
Python :: Converting a HDFDataset to numpy array 
Python :: how to save string json to json object python 
Python :: Print characters from a string that are present at an even index number 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =