checking wether string needs base64-encoding or not

Bjørn Ove Grøtan bgrotan at stud.ntnu.no
Sat May 25 11:58:32 EDT 2002


Chris Liechti wrote:
> 
> 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"
thanks! works like a charm...

Best regards

Bjørn Grøtan



More information about the Python-list mailing list