import re a = input() b = re.sub('#.*$','',a) #匹配的模式字符串'#.*$'意思是,以#连着任意字符的字符串,且这个字符串作为结尾去匹配 print(b)