Skip to content

Instantly share code, notes, and snippets.

@carlcrott
Created April 5, 2015 00:56
Show Gist options
  • Save carlcrott/6bcaa8c656924432c603 to your computer and use it in GitHub Desktop.
Save carlcrott/6bcaa8c656924432c603 to your computer and use it in GitHub Desktop.
def sanitise_single_string(unclean):
if unclean and bool( re.match(r'^[\w-]+$', unclean) ):
# do splice
raw_load_data = splice_db_into_dataframe(raw_load_data, unclean)
elif unclean:
# logging malformed metername
logging.warning('Error parsing meter name: ' + unclean + ' ... must match regex: ^[\w-]+$')
clean = unclean
del( unclean )
return clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment