I have a list like:
barcode = ["13350V1","13350V10","13350V2","13350V20"]
I want to sort this list based on the last three digits, so the result would be:
newbarcode = ["13350V1","13350V2","13350V10","13350V20"]
Now I am able to do this using the script below, but I am not exactly sure what does this mean (x: str(x)[-3]
) and appreciate your help in this regard.
newbarcode = sorted(barcode, key=lambda x: str(x)[-3])