python - How can I use list comprehension in following scenario? -


for key in enron_data.keys():     if(enron_data[key]['email_address'] != 'nan'):         count += 1 print count 

enron_data 2d dictionary, containing names & value,key pairs

can use len(..)

len( [v v in enron_data.values() if v['email_address'] != 'nan'] ) 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -