(Python) Best way to remove non alphanumeric characters: converting text file into list of strings : <pre><code>def getCandidates(f):
try:
    candidates = []
    flist = open(f,"r")
    for line in flist:
        line = line.strip()
        if (line==""):
            continue
        candidates.append(line)
    return candidates

except IOError:
     print("Filename not found")
     return candidates
</code></pre>

<p>Need to remove any non alphanumeric characters coming from a text file into a list of strings, should I use a another loop or is there a way to implement it into my existing code.</p>

<p>Cheers.</p>
