A sting (str
-type) in Python is a series of bytes. There is no way of telling just from looking at the string whether this series of bytes represent an ascii string, a string in a 8-bit charset like ISO-8859-1 or a string encoded with UTF-8 or UTF-16 or whatever.
However if you know the encoding used, then you can decode
the str into a unicode string and then use a regular expression (or a loop) to check if it contains characters outside of the range you are concerned about.