2014-04-07 2 views

답변

0

소스 패키지 python-extractor에는 extract.py이라는 파일이 있으며이 파일에는 libextractor 파이썬 바인딩 사용 방법에 대한 간단한 데모가 있습니다. extract.py

import extractor 
import sys 
from ctypes import * 
import struct 

xtract = extractor.Extractor() 

def print_k(xt, plugin, type, format, mime, data, datalen): 
    mstr = cast (data, c_char_p) 
# FIXME: this ignores 'datalen', not that great... 
# (in general, depending on the mime type and format, only 
# the first 'datalen' bytes in 'data' should be used). 
    if (format == extractor.EXTRACTOR_METAFORMAT_UTF8): 
     print "%s - %s" % (xtract.keywordTypes()[type], mstr.value) 
    return 0 


for arg in sys.argv[1:]: 
    print "Keywords from %s:" % arg 
    xtract.extract(print_k, None, arg) 

에서

내용은 파이썬 추출기의 더 나은 이해가 extractor.py에 소스 코드를 이동하십시오.

+0

감사합니다. 모든 것이 작동합니다. 정말 도움이되었습니다. – user3506695

관련 문제