python

16、json

# -*- coding:UTF-8 -*-

import json
import re

data = {"Fence":[{"Type":2,"OrganizationId":"qqq","StationId":"ppp","Id":"ooo","Name":"ttt"}]}

# json to str
data_str = json.dumps(data)
print(type(data_str))
print(data_str)


#str to dict
user_dict = json.loads(data_str)
tt = user_dict['Fence'][0]['Type']
print tt

15、python flask 登陆界面,表单

https://blog.csdn.net/aimill/article/details/81352684

14、python时间日期日历

https://www.runoob.com/python/python-date-time.html

13、python函数/参数、返回值

https://www.cnblogs.com/ilym/p/8310752.html

12、python线程同步

event

http://blog.51cto.com/freshair/1899372

queue

https://blog.csdn.net/qq_39304201/article/details/79654711

mutex

https://www.2cto.com/kf/201706/653087.html

11、python读取shell指令

#output = os.popen(message['data'])
#logs=output.readlines()
#for line in logs:
#    print line
 
return_code, logs = commands.getstatusoutput(message['data'])
print logs

10、python_version_checkout

楼主是Ubuntu14.04版本,一直以来想用Python3版本,但是又不能把自带的Python2版本卸载,据说卸载之后系统会不稳定。因此一直苦于Python2和Python3无法及时切换,导致软件弄混。后来终于找到一个方法可以完美切换。切换方法如下:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

然后再输入:

sudo update-alternatives --config python

根据数字选择你想要的Python版本。这时,Python及其对应的pip都跟着变成默认的了。

9、virtualenv

sudo apt-get install python-pip
sudo pip install virtualenv
virtualenv -p /usr/bin/python env
source env/bin/activate
pip --version
pip install --upgrade tensorflow

pip install -r requirements.txt

8、requirements.txt

pip freeze > requirements.txt

pip install -r requirements.txt

 

7、python读写shell

https://www.cnblogs.com/snow-backup/p/5035792.html

 

6、Ubuntu环境下python2和python3切换

https://blog.csdn.net/gan_player/article/details/72057966

5、python和c语言参数传递

1)c--->python
http://blog.csdn.net/JoeBlackzqq/article/details/10441017
http://blog.csdn.net/chenyulancn/article/details/8158168
2)python--->c
http://blog.csdn.net/mrcheny/article/details/79022973

 

4、python使用ctypes调用C/C++

http://blog.csdn.net/u012449363/article/details/75452374

3、使用python向C语言的链接库传递数组、结构体、指针类型的数据

http://blog.csdn.net/u012449363/article/details/76690540

2、Python Ctypes结构体指针处理(函数参数,函数返回)

本文演示了在python中调用C语言生成的动态库,返回结构体指针,并进行输出!

http://blog.csdn.net/joeblackzqq/article/details/10441017

1、浅谈 Python 程序和 C 程序的整合

https://www.ibm.com/developerworks/cn/linux/l-cn-pythonandc/

0、python读写json文件

https://www.jianshu.com/p/a4a7d75bf7d9

原文地址:https://www.cnblogs.com/dong1/p/6408355.html