I'm receiving the following error in my programm:
Traceback (most recent call last):
File "bookmarks.py", line 26, in <module>
zipping = dict(zip(datelist, matchhref))
TypeError: unhashable type: 'list'
I want to make dictionary from two lists (datelist and matchhref), but somehow when I use zip(), it returns list instead of tuple.
Here's my code:
import re
bm_raw = open('bookmarks.txt', 'r')
bm_line = bm_raw.read()
matchhref = re.findall('(<DT><A HREF=".*?</A>)', bm_line)
massive = list()
datelist = list()
a = 0
for i in matchhref:
temp = matchhref[a]
found = re.findall('(\d\d\d\d\d\d\d\d\d\d)', temp)
datelist.append(found)
a=a+1
print datelist
print matchhref
zipping = dict(zip(datelist, matchhref))
And here's contents of bookmarks.txt:
<DT><A HREF="some random data" ADD_DATE="1460617925" ICON="some random data">priomap</A>
<DT><A HREF="some random data" ADD_DATE="1455024833" ICON="some random data">V.34</A>
re.searchand call.groupand append thatfindall('\d{10}')on each line of the file?