I am trying to create a alphanumeric serial number in Python, the serial number is governed by the following rules:
3-Digit Alphanumeric Series Allowed values 1-9 (Zero is excluded) and A-Z (All Capitals with exclusions of I and O) The code should be able to give the next number after getting the input number.
For example: If the input number 11D then the output number should be 11E and if the input number is 119 then output should be 12A instead of 120. Please let me know if this description is good enough to explain my requirement.
I am currently using the code mentioned below:
def next_string(self, s):
strip_zs = s.rstrip('z')
if strip_zs:
return strip_zs[:-1] + chr(ord(strip_zs[-1]) + 1) + 'a' * (len(s) - len(strip_zs))
else:
return 'a' * (len(s) + 1)