Karthik324

Untitled

Aug 4th, 2021
594
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #function to remove comments
  2.  
  3. def remove_comments(string, lang):
  4.     if lang == 'Python':
  5.         pattern = "('''[\s\S]*''')|(''[\s\S]*''')"
  6.     else:
  7.         pattern = '\/\*[\s\S]*\*\/'
  8.     string = re.sub(pattern, '', string)
  9.     return string
  10.  
  11. #regex pattern to search for non empty blocks/cells
  12. pattern = '[^\s\xa0�]'
RAW Paste Data