I want to create a dictionary in which each key will have names like doc1
, doc2
,....,doc2105
and it will store value from Title_Loans.documents[0]
,Title_Loans.documents[1]
,....,Title_Loans.documents[2104]
.
I am trying to run a for loop on length(Title_Loans.documents
) inside a dictionary but it is showing error:
for i in range(len((Finance.documents)):
^
SyntaxError: invalid syntax
Below is the code I am running. Please suggest me how this can be done. Code: Sample:
docs = {
'doc1': Title_Loans.documents[0],
'doc2': Title_Loans.documents[1],
'doc3': Title_Loans.documents[2],
'doc4': Title_Loans.documents[3],
'doc5': Title_Loans.documents[4]
}
Trying to run above code using for loop for large document size.
docs = {
for i in range(len((Finance.documents)):
doc[i]: Finance.documents[i]
}