"Fossies" - the Fresh Open Source Software Archive

Member "file-5.35/python/example.py" (17 Jan 2011, 207 Bytes) of package /linux/misc/file-5.35.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "example.py" see the Fossies "Dox" file reference documentation.

    1 #! /usr/bin/python
    2 
    3 import magic
    4 
    5 ms = magic.open(magic.NONE)
    6 ms.load()
    7 tp = ms.file("/bin/ls")
    8 print (tp)
    9 
   10 f = open("/bin/ls", "rb")
   11 buf = f.read(4096)
   12 f.close()
   13 
   14 tp = ms.buffer(buf)
   15 print (tp)
   16 
   17 ms.close()