String operations to remove white spaces

s=" t  ioi ii "
t1=s.rstrip() # removes trailing white space
t2=s.lstrip() # removes leading white space
t3=s.strip()  # removes leading and trailing white space

print s

print t1

print t2

print t3

No comments: