我有几个这样的字母数字string listOfNum = ['000231512-n','1209123100000-n00000','alphanumeric0000', '000alphanumeric'] 消除尾随零的所需输出将是: listOfNum = ['000231512-n','1209123100000-n','alphanumeric', '000alphanumeric'] 前导零的期望输出是: listOfNum = ['231512-n','1209123100000-n00000','alphanumeric0000', 'alphanumeric'] 去除前导零和后缀零的欲望输出将是: listOfNum = ['231512-n','1209123100000-n00000','alphanumeric0000', 'alphanumeric'] 现在我已经这样做了,请build议一个更好的方法,如果有: listOfNum = ['000231512-n','1209123100000-n00000','alphanumeric0000', \ '000alphanumeric'] trailingremoved = [] leadingremoved = [] bothremoved = [] # Remove trailing for i in listOfNum: while i[-1] == "0": i = i[:-1] trailingremoved.append(i) # Remove leading for i […]