Guest User

Untitled

a guest
Apr 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. "_id" : ObjectId("5addb57d0043582d48ba898a"),
  2. "success" : true,
  3. "timestamp" : 1524477784,
  4. "base" : "EUR",
  5. "date" : "2018-04-23",
  6. "rates" : {
  7. "AED" : 4.492662,
  8. "AFN" : 85.576329,
  9. "ALL" : 128.39508,
  10. "AMD" : 586.837094,
  11. "ANG" : 2.177608,
  12. "AOA" : 267.092358,
  13. "ARS" : 24.678283,
  14. "AUD" : 1.602032,
  15. "AWG" : 2.177639,
  16. "AZN" : 2.079155,
  17. "BAM" : 1.958775,
  18. "BBD" : 2.446786,
  19. "BDT" : 101.517146,
  20. "BGN" : 1.943843,
  21. "BHD" : 0.460968,
  22. "NOK" : 9.626194,
  23. }
  24.  
  25. import pymongo
  26.  
  27. uri = "mongodb://127.0.0.1:27017"
  28. client = pymongo.MongoClient(uri)
  29. database = client['db']
  30. collection = database['currency']
  31. collection2 = database['countries']
  32. p = str(input('Insert the country: ')).capitalize()
  33.  
  34. if p=='Norway':
  35. currency = collection.find_one({'NOK'})
  36. print(currency)
  37.  
  38. currency = collection.find_one({"NOK"})
  39. print(currency['rates']['NOK'])
Add Comment
Please, Sign In to add comment