[Solved] How to increment numaric values only of alphanumeric values [duplicate]


Just because you asked nicely 😀

You can use the simplest for loop, with str.zfill to pad with zeroes, then add it to the 'nam' prefix like this:

for i in range(1,11):
    proId = 'nam' + str(i).zfill(3)
    print(proId) # or do whatever you need with it...

Output:

nam001
nam002
...
nam009
nam010

1

solved How to increment numaric values only of alphanumeric values [duplicate]