handle non ascii code string in python
问题 It is really confusing to handle non-ascii code char in python. Can any one explain? I'm trying to read a plain text file and replace all non-alphabetic characters with spaces. I have a list of characters: ignorelist = ('!', '-', '_', '(', ')', ',', '.', ':', ';', '"', '\'', '?', '#', '@', '$', '^', '&', '*', '+', '=', '{', '}', '[', ']', '\\', '|', '<', '>', '/', u'—') for each token i got, i replace any char in that token with space by calling for punc in ignorelist: token = token.replace