Q:

How can lines with other characters than letters be removed from output?

I have a code where I extract bigrams from a large corpus, and concatenate/merge them to get unigrams. 'may', 'be' --> maybe. The corpus contains, of course, a lot of punctuations, but I also discovered that it contains other characters such as emojis... My plan was to put punctuations in a list, and if those characters are not in a line, print the line. Maybe I should change my approach and only print the lines ONLY containing letters and no other characters, since I don't know what kinds of characters are in the corpus. How can this be done? I do need to keep these other characters for the first part of the code, so that bigrams that don't actually exist are printed. The last lines of my code are at the moment:
    counted = collections.Counter(grams)
    for gram, count in sorted(counted.items()):
        s = ''
        print (s.join(gram))

And the output I get is:
   !aku
   !bet
   !brå
   !båda

These lines won't be of any use for me... Would really appreciate some help! :) 

A:

If you want to check that each string contains only letters you can probably use the isalpha() method.
>>> '!båda'.isalpha()
False
>>> 'båda'.isalpha()
True

As you can see from the example, this method should recognize any unicode letter, not just ascii.

