BluePrintRandom
BluePrintRandom

Reputation: 146

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

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)

Upvotes: 0

Views: 68

Answers (2)

Ionut Hulub
Ionut Hulub

Reputation: 6326

like this:

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

Upvotes: 2

Dave Pedu
Dave Pedu

Reputation: 1

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

Upvotes: 1

Related Questions