Noob question about suffixes... i guess

why is this code not working =“0”), i want to remove the zeros from suffixes .001 .002 .003 and so on.
i have tried storing the obj name in a variable first, str = = str.strip(“0”)

do i have to split(’.’) first or something?

The code works, it is just not doing what you want. strip() removes leading and trailing characters - whitespace by default.

You probably want replace() or to split the strings apart. Using regex is left as an exercise to the reader.

1 Like

thanks for the replay, i endup using:

`for obj in whatever:
if “.” in
suffix =[-3:]
stripp = obj.strip(suffix) = stripp+ str(counter1)
if counter1 <= len( number_of_selected_objects):
counter1 += 1´

as part of a loop, and worked just fine.

i’m sure =“0”,"") should do the job, how ever im no sure if it would give the unwanted result to leave a blank space in between the dot and the number. like so “obj_name. 1”