It is a memo
When you want to separate the output of TCPdump with a character, you may want to delete it if the last character of the IP is ":". ~~ At that time ~~
laststring.py
str="1234:5678:abcd:231a:"
if(str[-1:]==":"):
print(str[:-1])
else:
print(str)
You can go ~~
This one was better
str="1234:5678:abcd:231a:"
print(str.rstrip(':'))
Recommended Posts