Skip to content

Instantly share code, notes, and snippets.

@Allwin12
Created January 20, 2020 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Allwin12/d9cc120949536d5e8e95e71ee363a32f to your computer and use it in GitHub Desktop.
Save Allwin12/d9cc120949536d5e8e95e71ee363a32f to your computer and use it in GitHub Desktop.
myArray = ['teststring1','strringrr','wow','strarirngr']
letter = "r"
amount = 4
filtered = [item for item in myArray if item.count(letter) == amount]
print(filtered) # ['strringrr', 'strarirngr']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment