Although I would recommend the grep solution, you asked for biopython.
Perhaps your question fits in a larger project (which might be a reason to go for a larger script).
Since you suggest biopython I assume you already have a basic knowledge and I won't write out your script :-)
So your strategy, and a bit of pseudocode:
parse the fastq (see biopython cookbook), and check for every sequence in your fastq whether you can find a match, easy as pie(thon)
with seqrecord your fastq record
with searchlist your sequences you want to select for (read from file, beware of line terminators)
with open('ids.txt') as inputfile:
searchlist = [item.strip() for item in inputfile.readlines()]
Followed by something like:
for seqrecord in records:
if [item for item in searchlist if seqrecord.seq.count(item)]: #List comprehensions are awesome, empty list = False
outlist.append(seqrecord)
If you need additional help, tell me what doesn't work and I'll be happy to have a look.
using simple grep you can extract.
text_file should have all your 10bp sequences one per line. if you want to separate reads for every pattern,