摘要: Python中判断list是否为空有以下两种方式: 方式一: 方式二: 以上两种方法均可以判断出 list_temp 列表是否是空列表,第二个方法要优于第一个方法,在Python中,False,0,'',[],{},()都可以视为假。 阅读全文
posted @ 2018-11-01 15:13 salami_china 阅读(4925) 评论(0) 推荐(0) 编辑
摘要: 1 #!/usr/bin/env python 2 3 from sqlalchemy.orm import sessionmaker 4 from sqlalchemy import create_engine 5 from sqlalchemy.ext.declarative import de 阅读全文
posted @ 2018-11-01 14:52 salami_china 阅读(1408) 评论(0) 推荐(0) 编辑
摘要: 1 import socket 2 import uuid 3 4 # 获取主机名 5 hostname = socket.gethostname() 6 #获取IP 7 ip = socket.gethostbyname(hostname) 8 # 获取Mac地址 9 def get_mac_address(): 10 mac=uuid.UUID(int = uui... 阅读全文
posted @ 2018-11-01 09:04 salami_china 阅读(776) 评论(0) 推荐(0) 编辑