type(s)
One will sayunicode, the other will saystr.
You can handle them separately usingisinstance, e.g.
ifisinstance(s,str):print's is a string object'elifisinstance(s,unicode):print's is a unicode object'
Or do you mean you have astr, and you are trying to figure out if it is encoded usingASCIIorUTF-8or something else?
In that case, try this:
s.decode('ascii')
if it raises an exception, the string is not 100% ASCII.