1e0ng / simhash

A Python Implementation of Simhash Algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python2.6 run it ,error

yuanjianfaith opened this issue · comments

error info:
Traceback (most recent call last):
File "test.py", line 2, in
from simhash import Simhash
File "/usr/lib/python2.6/site-packages/simhash/init.py", line 69
features = {k:sum(1 for _ in g) for k, g in groupby(sorted(features))}
^
SyntaxError: invalid syntax

this is my code

coding=utf-8

from simhash import Simhash

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

#print(Simhash('哎,江明也才发现,这边页面里面隐藏跳转都有好多页面,全部很满,基本不能共用,又没设计图,周三做完不可能了,做出来多半也是废的会重做').value)
#print(Simhash("this is test demo wewr").value)

features = {k:sum(1 for _ in g) for k, g in groupby(sorted(features))}

2.6好像不支持这种写法.用2.7试试

commented

Please use Python 2.7+ or 3.4+