1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| import pandas as pd
#first u have to open the file and seperate every line like below:
with open(r'C:\Users\User\Desktop\rockyou-withcount.txt', "r",encoding="ISO-8859-1") as f:
lines = f.readlines()
df_result = pd.DataFrame(columns=('id', 'password'))
for i,line in enumerate(lines):
id, password = line.split()
df_result.loc[i] = [id, password]
for i in df_result.index:
result = 1 - spatial.distance.cosine(df_result["id"][i], df_result["password"][i])
print(result)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2980/3535905508.py in <module>
10
11 for i,line in enumerate(lines):
---> 12 id, password = line.split()
13 df_result.loc[i] = [id, password]
14
ValueError: too many values to unpack (expected 2) |
Partager