
python学习
TTonlyV5
总有一些人过着你想要的生活。
展开
-
python中json对象转换出错解决方法
今天在使用python中的json转换碰到一个问题: 接收一个post的json字符串: s={"username":"admin","password":"password","tenantid":""} 使用python自带的json库 1 2 3 4 5 6 7 8 9 10 im转载 2016-07-11 11:24:05 · 4024 阅读 · 0 评论 -
json.load(f)方法使用*.json备忘
在python中使用JSON,导入出现错误了,类型错误等。#!/usr/bin/python import json f = open('data.json', encoding='utf-8') s = json.load(f) print(s) print(s.keys()) print(s["title"])在导入时data.json已经是一个字典了,所以需要变成字符串,在使用s = j原创 2016-07-04 16:20:50 · 12242 阅读 · 1 评论 -
Python使用XML操作mapnik,实现复杂标注(Multi line text symbolizer)
test.pyimport mapnik stylesheet = 'world_style.xml' image = 'world_style.png' m = mapnik.Map(1200, 800) mapnik.load_map(m, stylesheet) m.zoom_all() mapnik.render_to_file(m, image) print "rendered imag原创 2017-04-14 15:54:34 · 1165 阅读 · 0 评论