Skip to content

Instantly share code, notes, and snippets.

@peterk87
Created April 22, 2013 16:27
Show Gist options
  • Save peterk87/5436491 to your computer and use it in GitHub Desktop.
Save peterk87/5436491 to your computer and use it in GitHub Desktop.
Python: Get list of files containing a specified string/extension and print to stdout
import os
# get a list of files containing a certain string/extension
l = [f for f in os.listdir('.') if '.markers' in f]
lFNA = [f for f in os.listdir('.') if '.fna' in f]
# print the matching files to stdout
# get commandline command for running MIST
print 'MIST.exe -j mist.json -T tmp -t ' + ' -t '.join(l) + ' ' + ' '.join(lFNA)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment