When u want to do some processes on lines in a file which do not have alphabetical characters, for example, a liner list of some numerical values, the following if sentence could work:
import re
for line in f:
if not re.compile(r'[A-z]').search(line):
Since the regular expression can be modified to other conditions, I like this more basic if sentence more than a specific method, isalpha().