I might be asking this wrong, but please help if I am. I need to establish whether a string contains non-ascii characters in order to separate them from the ones that is purely ascii.
I gather a string from multiple separate files and need to remove the non-ascii containing ones so that I can place the strings in a list to be used further. Without any filtering I get the following error while extracting the strings:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xeb' in position 40: ordinal not in range(128)
I would like to achieve the following:
Read string
if string contains non-ascii
->add to list
else
->do not add to list.
All I need to do is determine the how to filter, I have the rest of the code in tact.