strip

look at the following code:

filename = "0828r_aarch64.tar"
print(filename.rstrip("_aarch64.tar"))

Intuitively, this code should output 0828r, but it actually outputs 0828, why?

because srtip is a function that removes the specified character from the right side of the string, not the string itself.

so .rstrip("_aarch64.tar) will remove all characters in the string _aarch64.tar, include _, a, r, c, h, 6, 4, ., t, after remove _aarch54.tar, the string 0828r is left, the right side of 0808r is r, so r will be removed, the final result is 0828.