美文网首页Python四期爬虫作业
【Python爬虫】-8/15课后作业

【Python爬虫】-8/15课后作业

作者: Allen_Zhao | 来源:发表于2017-08-16 21:26 被阅读0次

    #1

    importjson

    #2

    dict_a={}

    dict_b={}

    #3

    dict_a['a1']='b1'

    dict_a['a2']='b2'

    dict_a['a3']='b3'

    #4

    ks=dict_a.keys()

    print(ks)

    print(type(ks))

    #5, 6

    vs=dict_a.values()

    print(vs)

    print(dict_a.items())

    #7 8

    dict_a['a1']='b3'

    dict_a['a3']='b1'

    print(dict_a)

    #9 10

    dict_a.pop('a1')

    print(dict_a)

    #11

    dict_b.update(dict_a)

    #12 13 14

    print(dict_b)

    a1=dict_b.get('a1')

    print(a1)

    #15 16

    dict_b['a1']=a1

    dict_b['a4']='null'

    print(dict_b)

    print(type(dict_b))

    #17 18

    json_c ="""

    [

    {

    "dict_b": {

    "a2": "b2",

    "a3": "b1",

    "a1": None,

    "a4": "null"

    }

    }

    ]

    """

    print(json_c)

    print(type(json_c))

    #19

    json_c=json.dumps(json_c)

    dict_c=json.loads(json_c)

    print(dict_c)

    print(type(dict_c))

    相关文章

      网友评论

        本文标题:【Python爬虫】-8/15课后作业

        本文链接:https://www.haomeiwen.com/subject/ndewrxtx.html