提到的代码无法接受输入
037-00901-00027
#batch printer
batch_id=float(input("enter your product ID"))
print("Your Country code is=", batch_id[0:3])
print("Your product code is=", batch_id[4:9])
print("Your Batch Number is=", batch_id[9:13])
batch_id = input("enter your product ID: ")
IDs = batch_id.split('-')
print("Your Country code is =", IDs[0])
print("Your product code is =", IDs[1])
print("Your Batch Number is =", IDs[2])
尝试
batch_id=str(input("enter your product ID"))
splitter = batch_id.split('-')
print("Your Country code is=", splitter[0])
print("Your product code is=", splitter[1])
print("Your Batch Number is=", splitter[2])