错误代码:
if __name__ == '__main__': str="[Type=UPC-A][Final=10][Nnmber=9]" for item in str.split("]"): print(item.split('=')[1])
正确代码:
if __name__ == '__main__': str="[Type=UPC-A][Final=10][Nnmber=9]" for item in str.split("]")[0:-1]: print(item.split('=')[1])