Skip to content
Snippets Groups Projects

Filter Func (list comprehension)

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Magnus Maria Hoffmann
    Edited
    snippetfile1.txt 151 B
    # takes list and filters based on keyword
    def filterFiles(file_list, keyword): 
        return [filename for filename in file_list if keyword in filename] 
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment