Requirements for Installing Packages
https://packaging.python.org/installing/#id14pycharm专业版激活
http://blog.lanyus.com/archives/174.html
http://blog.csdn.net/inter_peng/article/details/53222562安装numpy,matplotlib,scipy (windows 下2.7.13)
python -m pip install numpy
python -m pip install matplotlib
python -m pip install numpy-1.11.3+mkl-cp27-cp27m-win_amd64.whl
python -m pip install scipy-0.19.1-cp27-cp27m-win_amd64.whl
python -m pip install scipy 安装scipy时需要先安装以上whl。
http://blog.csdn.net/inter_peng/article/details/53222562原生的json.tool使用ascci解码utf-8,导致utf-8字符被直接显示,而没有显示中文。
import sys
import json
import codecs
def main():
if len(sys.argv) == 1:
infile = sys.stdin
outfile = sys.stdout
elif len(sys.argv) == 2:
infile = open(sys.argv[1], 'rb')
outfile = sys.stdout
elif len(sys.argv) == 3:
infile = open(sys.argv[1], 'rb')
outfile = open(sys.argv[2], 'wb')
else:
raise SystemExit(sys.argv[0] + " [infile [outfile]]")
try:
obj = json.load(infile)
except ValueError, e:
raise SystemExit(e)
s = json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False)
outfile.write(codecs.encode(s, 'utf-8'))
outfile.write('\n')
if __name__ == '__main__':
main()
cat result.json| python -m json.tool