当前位置:网站首页>Vipshop work practice: Jason's deserialization application
Vipshop work practice: Jason's deserialization application
2022-06-26 09:08:00 【Feng Dashao】
JSON(JavaScript Object Notation) Is a lightweight data exchange format , It is JavaScript Subset , Easy to read and write . There are two common types of structures ,Key_Value An ordered list of sets and values for , They correspond to each other Python Dictionaries and lists in .
JSON There are the following methods in common use :
The following is based on the working practice in vipshop , demonstration Json Of deserialization application . Open one of the links , Visible mainly through API(Application Programming Interface) Load data . stay Request URL in ,? Behind it is a pile of contents that seem to be alien texts , These are all query strings . Pair with key value key=value The formal assignment of , Use... Between multiple key value pairs & come together . Query string is used for information transmission , The server can know what you want through it , So as to return the corresponding content to you .
First try to get the web page source code data , And then try to pass json() Method to decode the response content , As a result, the decoding error prompt is encountered .
stay " Preview" so , Not at all Json data format .
First use replace() Method hold ‘getMerchandiseDroplets1(’ and ‘)’ Delete , And then through json.loads() Method , After deserialization , Successfully converted to Python Data objects for - dict
Join the loop , You can use dict Value , Print out all relevant product names .
for i in range(33):
print(str1_json[‘data’][‘products’][i][‘title’])
边栏推荐
- 反爬之验证码识别登录 (OCR字符识别)
- Phpcms V9 remove the phpsso module
- 力扣399【除法求值】【并查集】
- Notes on setting qccheckbox style
- Efficiency thesis Reading 1
- 行為樹XML文件 熱加載
- Yolov5 advanced zero environment rapid creation and testing
- 框架跳转导致定位失败的解决方法
- phpcms手机站模块实现自定义伪静态设置
- In automated testing, there are three commonly used waiting methods: sleep, implicitly\wait, and expected\u conditions
猜你喜欢
Section IV HQL execution process
yolov5进阶之零环境快速创建及测试
Yolov5进阶之二安装labelImg
phpcms v9去掉phpsso模块
dedecms小程序插件正式上线,一键安装无需任何php或sql基础
实践是成为网工最快的方法,网络工程师实战项目整理
Upgrade phpcms applet plug-in API interface to 4.3 (add batch acquisition interface, search interface, etc.)
Data warehouse (3) star model and dimension modeling of data warehouse modeling
[300+ continuous sharing of selected interview questions from large manufacturers] column on interview questions of big data operation and maintenance (I)
Phpcms V9 mall module (fix the Alipay interface Bug)
随机推荐
Yolov5 advanced 5 GPU environment setup
1.17 daily improvement of winter vacation learning (frequency school and Bayesian school) and maximum likelihood estimation
百度小程序富文本解析工具bdParse
Yolov5 advanced III training environment
Selenium builds cookies pool to bypass authentication and anti crawl login
dedecms小程序插件正式上线,一键安装无需任何php或sql基础
MySQL cannot be found in the service (not uninstalled)
[IVI] 15.1.2 system stability optimization (lmkd Ⅱ) psi pressure stall information
Notes on setting qccheckbox style
Mongodb分片环境搭建和验证(redis期末大作业)
Tensor
深度学习论文阅读目标检测篇(七)中文版:YOLOv4《Optimal Speed and Accuracy of Object Detection》
yolov5进阶之零环境快速创建及测试
Pytorch neural network
上下架和橱窗推荐如何设置,优化过程需要注意的地方
Code de mise en œuvre de l'intercepteur et du filtre
Yolov5进阶之三训练环境
Unity connects to Turing robot
Phpcms V9 background article list adds one click push to Baidu function
[qnx hypervisor 2.2 user manual]12.1 terminology (I)