Hi!

I have a file with data that looks like that:

123 34 0.45
232 54 0.01

And so on (the file contains more than 1300 lines). I am trying to make dictionary from the data (like this: dict={0.45:'123_34',0.01:'232_54',...}).

The problem is that I didn't get more than 1300 elements in dictionary (as I should) but only around 60. Does anyone know the reason?

Recommended Answers

All 2 Replies

Duplicate keys?

E.g.,

123 34 0.45
707 55 0.45
621 38 0.45

Would leave you with {0.45:'621_38'}

Yes, that is the problem. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.