HassanK HassanK - 5 months ago 36
Python Question

Changing all values of string to a certain value

input = ["AB0","A","BBBB"]
output = ["000","0","0000"]

Is there a function like
.replace("", "")
which could take in any input and give a string of zeros with the same number of characters?


This will work:

input  = ["AB0","A","BBBB"]

output = ["0"*len(x) for x in input]

or the same:

input  = ["AB0","A","BBBB"]
output = []
for x in input: