How do I use Regex to remove "Sensor_" from a data set? this is example set, ["Sensor_01", "Sensor_10"}

73 Views Asked by At

How do I use Regex to remove "Sensor_" from a data set? this is example set, ["Sensor_01", "Sensor_10"}

??

I am having some trouble with understanding all the symbols, (dyslexia)

2

There are 2 best solutions below

1
On BEST ANSWER

like this:

dataset = ['Sensor_01', 'Sensor_02', 'Sensor_03']
for i in range(len(dataset)):
    dataset[i] = dataset[i].replace('Sensor_', '')
print dataset
1
On

No need for regex here, simply replace all instances of "Sensor_" with nothing. This should help.