Use __iter__ rather than the inefficient nested for loops

This commit is contained in:
Kunal Mehta
2012-09-30 19:24:56 -05:00
parent 5ce25688e0
commit 5cd116d078
+2 -5
View File
@@ -311,11 +311,8 @@ def dict_from_cookiejar(cj):
cookie_dict = {}
for _, cookies in list(cj._cookies.items()):
for _, cookies in list(cookies.items()):
for cookie in list(cookies.values()):
# print cookie
cookie_dict[cookie.name] = cookie.value
for cookie in cj:
cookie_dict[cookie.name] = cookie.value
return cookie_dict