checking wether string needs base64-encoding or not

Chris Liechti cliechti at gmx.net
Sat May 25 11:18:57 EDT 2002


Bjørn Ove =?iso-8859-1?Q?Gr=F8tan?=  <bgrotan at stud.ntnu.no> wrote in 
news:3CEF984D.8FE17EE at stud.ntnu.no:

> Can somebody help me with example on how to check if string
> contains characters which needs to be base64-encoded 

mystr = "Wie wärs mit einem test?"    #8 bit data
if filter(lambda x: x>'\x7f', mystr):
    	print "contains 8 bit data"
else:
    	print "no more tahan seven bits"

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list