chomp

How to remove leading and trailing zeros in a string? Python

How to remove leading and trailing zeros in a string? Python Question: I have several alphanumeric strings like these listOfNum = [‘000231512-n’,’1209123100000-n00000′,’alphanumeric0000′, ‘000alphanumeric’] The desired output for removing trailing zeros would be: listOfNum = [‘000231512-n’,’1209123100000-n’,’alphanumeric’, ‘000alphanumeric’] The desired output for leading trailing zeros would be: listOfNum = [‘231512-n’,’1209123100000-n00000′,’alphanumeric0000′, ‘alphanumeric’] The desire output for removing both …

Total answers: 7