I have a large list containing strings. I wish to create a dict from this list such that:
list = [str1, str2, str3, ....]
dict = {str1:len(str1), str2:len(str2), str3:len(str3),.....}
My go to solution was a for loop but its taking too much time (my list contains almost 1M elements):
for i in list:
d[i] = len(i)
I wish to use the multiprocessing module in python in order to leverage all cores and reduce the time taken for the process to execute. I have come across some crude examples involving manager module to share dict between different processes but am unable to implement it. Any help would be appreciated!