spa = ' \t\r\n\f\t'
def rmlspa(string):
st = list(string)
print(st)
while True:
if st[0] in spa:
st.pop(0)
else:
break
return st
def rmrspa(string):
string.reverse()
while True:
if string[0] in spa:
string.pop(0)
else:
break
string.reverse()
return string
if __name__ == '__main__':
lspa = rmlspa(' \tHello World! ')
lrpa = rmrspa(lspa)
sep = ''
print(sep.join(lrpa))
# for i in lrpa:
# print(i, end='')