# Basic syntax:
import re
len(re.findall('[characters]', your_string))
# Example usage:
# say you want to count all G, g, C, or c characters in the following DNA seq
len(re.findall('[GgCc]', "ACGTGCAcgattcgatCGCTAGCTAG"))
--> 14
def containsAny(str, set):
""" Check whether sequence str contains ANY of the items in set. """
return 1 in [c in str for c in set]
def containsAll(str, set):
""" Check whether sequence str contains ALL of the items in set. """
return 0 not in [c in str for c in set]
print('-' * 20) # Print - 20 times on one line.
# output: --------------------