How to detect Chinese in a string?

Peter Otten __peter__ at
Sun Oct 12 14:38:17 CEST 2008

lookon wrote:

> I have a string a(for example, a='中文Chinese'), and I want to know
> whether there are some Chinese in the string.
> Can someone tell me how to do it? Thanks!


Instead of re.findall(...)

you may use

    print "There are Chinese chars"

Remember to decode the string with the proper encoding first, e. g.

a = a.decode("utf-8")


More information about the Python-list mailing list