Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- def interpretator(s):
- space_s=space(s)
- dash_s=dash(space_s)
- quote_s=quote(dash_s)
- tabs_s=tabs(quote_s)
- newline_s=newline(tabs_s)
- comma_s = comma(newline_s)
- dot_s = dot(comma_s)
- right_bracket_s = right_bracket(dot_s)
- return left_bracket(right_bracket_s)
- def left_bracket(s):
- # "( "
- return re.sub(r'\(\s', '(', s)
- def right_bracket(s):
- # " )"
- return re.sub(r'\s\)', ')', s)
- def comma(s):
- # " ,"
- return re.sub(r'\s[,]', ',', s)
- def dot(s):
- # " ."
- return re.sub(r'\s[.]', '.', s)
- def space(s):
- #
- return re.sub(r'\s+', ' ', s)
- def dash(s):
- # − to -
- return re.sub(r'\−','-',s)
- def quote(s):
- # “” to «»
- return re.sub(r'\“','«',re.sub(r'\”','»',s))
- def tabs(s):
- return s
- def newline(s):
- return s
- # main
- text_in = open('input.txt').read()
- print(interpretator(text_in))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement