# -*- coding: utf-8 -*-
"""
Created on Wed Feb 13 12:52:17 2019
@author: Administrator
"""
import time
import os
import difflib
if __name__ == '__main__':
a = '123456a'
b = '234567b'
Str = 'untitled48.py'
s1 = 'untitled49.py'
s2 = '上海中心'
s3 = '上海中心大厦2'
s4 = '上海中心大厦上海中心大厦3'
print(difflib.SequenceMatcher(None, Str, s1).quick_ratio())
print(difflib.SequenceMatcher(None, Str, s2).quick_ratio())
print(difflib.SequenceMatcher(None, Str, s3).quick_ratio())
print(difflib.SequenceMatcher(None, Str, s4).quick_ratio())
Str = '关于报送电话的通知'
Str2 = '关于报送电话的通知1'
print(difflib.SequenceMatcher(None, Str, s1).quick_ratio())
fileList=[]
fileDict={'title': 'The Pork of Music', 'year': '2012'}
fileList.append(fileDict)
print(fileList)
num=0
path = "F:\\PythonWebPYCode"
listS = os.listdir(path)
print(listS)
print("*************************")
for i in listS:
#print(i) os.path.join(path, name)
#i = os.path.join(path, i)
fileDict['title']=i
fileDict['year']=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(os.path.getatime(i)))
print(fileDict)
fileList.append(fileDict.copy())
#fileList[num]=fileList[num]+fileD
print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
print(fileList)
tempList=[]
newList=[]
print("com++++++++++++++++++++++++++++++++++++++++++++++++++++")
print(len(fileList)-1)
for num,m in enumerate(fileList):
print(m['title'])
print(fileList[num]['title'])
tempList.append(m['title'])
num=num+1
if num==len(fileList)-1:
break
if difflib.SequenceMatcher(None, m['title'],fileList[num]['title']).quick_ratio()>0.8:
print("same")
else:
print("differ.....")
newList.append(tempList)
tempList=[]
continue
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print(newList)
print("result...............<<<<<<<<<<<<<<<<<<,")
for mma in newList:
print(mma)
print("result...............&&&&&&&&&&&&&&&&&&&&&&&")
for mma in newList:
print(mma[0])
[‘UploadFile.py’]
[‘code.py’, ‘code2.py’]
[‘css01’]
[‘fsdf’]
[‘LinkImage’, ‘LinkImage3’]
[‘loadTXT’]
[‘microblog-0.2’, ‘microblog-0.3’]
[‘mma’]
[‘mma.rar’]
[‘muban2’]
[‘showTXT’]
[‘SuperLink2’]
[‘testaaa’]
[‘tttsss’]
[‘txtFile’]
[‘untitled55.py’]
result…&&&&&&&&&&&&&&&&&&&&&&&
UploadFile.py
code.py
css01
fsdf
LinkImage
loadTXT
microblog-0.2
mma
mma.rar
muban2
showTXT
SuperLink2
testaaa
tttsss
txtFile
untitled55.py