> 
> 
> import os
> def test_file(filename, maxread=1024):
>    if os.path.isdir(filename):
>      return 'directory'
>    afile = open(filename) # open as text
>    for achar in afile.read(maxread):
>      if ord(achar) > 127:
>        return 'binary'
>    return 'text'
> 
> 

Pefect, thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to