Skip to content

Instantly share code, notes, and snippets.

@syanle
Created February 1, 2018 07:37
Show Gist options
  • Save syanle/4d78ea44b5b2f296a0ce7a1b0cd663c3 to your computer and use it in GitHub Desktop.
Save syanle/4d78ea44b5b2f296a0ce7a1b0cd663c3 to your computer and use it in GitHub Desktop.
def valid_file(param):
base, ext = os.path.splitext(param)
if ext.lower() not in ('.tsv', '.tab'):
raise argparse.ArgumentTypeError('File must have a tsv or tab extension')
return param
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment