First, online tools
1.https://www.sojson.com/
2.http://www.w3cshool.com.cn/json/
3.http://www.runoob.com/json/json-tutorial.html
二、JSON(JavaScriptObjectNotation)
1.json format is a set of key data in the form of
(1) key: the string (2) value: strings, numbers, a list, JSON
(3) json wrap braces (4) directly key-value pairs separated by commas
Python format and corresponding to 2.json
(1) String - string (2) Digital - Digital (3) queue -list (4) Object -dict (5) Boolean - Boolean, Boolean python, but the first letter is capitalized
3.python for json
(1) json package
(2) installed for json objects and python
json.dumps (): encoded data, converting format json format python
json.loads (): decoding the data, converting format json format python
import json student={ "name":"liuming", "age":18, "mobile":"15847562589" } print(type(student)) stu_json = json.dumps(student) # print(stu_json) print("JSON对象:{0}".format(stu_json)) stu_dict = json.loads(stu_json) print(stu_dict) print(type(stu_dict))
(3) python json file to read
json.dump (): write the contents of the file
json.loads (): read the contents of the file into python json
data = {"name":"hahah", "age":15 } with open("t.json","w") as f: The json.dump (Data, f) # converts data into python json format written to file f with open("t.json","r") as f: d = json.load(f) print(d)
Third, regular expressions
1 will be described for a single string which matches a string of a rule, it is often used to retrieve, to replace some of the text mode
2. Regular wording
. (Dot): Indicates any character except \ n, such as: Find all the characters \.
[]: Matches any character in brackets include, for example: [L, Y, 0],
\ D: any of a number
\ D: In addition to digital can
\ S: represents a space, tab key
\ S: for a blank sign
\ W: word character, is az.AZ, 0-9, _
\ W: In addition to word character
*: Indicates the contents of the previous item repeated zero or more times
Fourth, the source
D30_5_JsonAnalysis.py
D30_6_RegularExpression.py
https://github.com/ruigege66/Python_learning/blob/master/D30_5_JsonAnalysis.py
https://github.com/ruigege66/Python_learning/blob/master/D30_6_RegularExpression.py
2.CSDN: https: //blog.csdn.net/weixin_44630050 (Xi Jun Jun Moods do not know - Rui)
3. Park blog: https: //www.cnblogs.com/ruigege0000/
4. Welcomes the focus on micro-channel public number: Fourier transform public personal number, only for learning exchanges, backstage reply "gifts" to get big data learning materials