What's the difference between dictionary and JSON? Python learning

It education for old boys 2021-04-06 14:32:25
difference dictionary json python learning

Recently someone asked Xiaobian that :Python Developing dictionaries and Json What's the difference ? On this question , Xiao Bian will introduce you through the following .

What is a dictionary ?

A dictionary is a data structure , and json If it is a data format, there will be some formal restrictions , such as json The format of must and can only use double quotation marks as key Or the boundary sign of the value , You can't use single quotes , Using single quotation marks or not using quotation marks will result in reading data errors , and key You have to use a boundary character , But dictionaries don't matter , You can use single quotes , You can also use double quotes .

What is? json?

Literally, it means JavaScript Object notation , here json It means something similar to JavaScript Object is a data format object , At present, this data format is quite popular , Gradually replaced the traditional xml data structure , Front end use ajax The data format that the background returns to the front end is json Format .

Json and dict Difference and contrast ?

Json Of key It can only be a string ,Python Of dict It can be anything hash object ;

Json Of key It can be orderly 、 Repetitive ;dict Of key Not to be repeated ;

Json Of value It can only be a string 、 Floating point numbers 、 Boolean or null, Or an array or object of them ;

Json arbitrarily key There is a default value undefined,dict There is no default value by default ;

Json It can be accessed by [], It can also be ., The traversal mode is different in、of;dict Of value Subscript only access ;

Json Force double quotation marks on the string of ,dict Strings can be single quotes 、 Double quotes ;

Dict Can be nested tuple,json There are only arrays in it ;


Json Chinese must be Unicode code ,jason The type is string , The type of dictionary is dictionary .

本文为[It education for old boys]所创,转载请带上原文链接,感谢

  1. Docker | 多图预警 | 配置Docker下Python开发环境
  2. Docker | multi graph warning | configuring Python development environment under docker
  3. 课程学习记录之python迭代器和生成器
  4. Python_学习之流程控制
  5. Python_学习之运算符
  6. Python_学习之基础数据类型
  7. Python_学习之虚拟环境的搭建
  8. Python iterator and generator of course learning record
  9. Python_ Process control of learning
  10. Python_ Learning operators
  11. Python_ Basic data types of learning
  12. Python_ The construction of virtual learning environment
  13. 一个非常简单好用的 Python 图形界面库
  14. 我就是这样学 Python 的
  15. 零基础,从一个抢票程序,提升自己的Python技能
  16. A very simple and easy to use Python graphical interface library
  17. That's how I learned python
  18. 商业数据分析从入门到入职(9)Python网络数据获取
  19. Zero basis, improve your Python skills from a ticket grabbing program
  20. 商业数据分析从入门到入职(8)Python模块、文件IO和面向对象
  21. 商业数据分析从入门到入职(7)Python基础数据结构及其操作
  22. 商业数据分析从入门到入职(6)Python程序结构和函数
  23. Business data analysis from entry to entry (9) Python Network Data Acquisition
  24. Business data analysis from entry to entry (8) Python module, file IO and object oriented
  25. Business data analysis from entry to entry (7) Python basic data structure and its operation
  26. Business data analysis from entry to entry (6) Python program structure and function
  27. 简简单单实现 Python Web 的登录注册页面,还包含一半逻辑。
  28. Simple implementation of Python web login registration page, but also contains half of the logic.
  29. 什么是pip?Python新手入门指南
  30. What is PIP? Getting started with Python
  31. Python uses for... Else to jump out of double nested loop
  32. Python基础之:Python中的内部对象
  33. 人工智能入门:Python实现机器学习
  34. The foundation of Python: inner objects in Python
  35. Introduction to artificial intelligence: machine learning in Python
  36. Python基础之:Python中的内部对象
  37. The foundation of Python: inner objects in Python
  38. Python 小技之 Office 文件转 PDF
  39. 还在为多张Excel汇总统计发愁?Python 秒处理真香!
  40. 用 Python 制作音乐聚合下载器
  41. Spark Delta Lake 0.4.0 发布,支持 Python API 和部分 SQL
  42. How to transfer office files to PDF
  43. Are you still worried about multiple excel summary statistics? Python second processing really fragrant!
  44. Making music aggregate downloader with Python
  45. Spark delta Lake 0.4.0 is released, supporting Python API and part of SQL
  46. Python信息搜集
  47. Python information gathering
  48. Python - 关于类(self/cls) 以及 多进程通讯的思考
  49. Python - thinking about class (self / CLS) and multi process communication
  50. Python - 关于类(self/cls) 以及 多进程通讯的思考
  51. Python - thinking about class (self / CLS) and multi process communication
  52. Python信用评分卡建模(附代码)
  53. Python credit score card modeling (with code)
  54. 学Python需要学数据库吗?Python学习教程!
  55. Do you need to learn database to learn Python!
  56. Python私有变量如何定义?Python学习教程!
  57. How to define Python private variables? Python tutorial!
  58. Python数据分析入门(六):Pandas的函数应用
  59. Introduction to Python data analysis (6): function application of pandas
  60. 学Python需要学数据库吗?Python学习教程!