python项目-face++人脸识别考勤机-python_GUI-automatic_weather-face_gensui
python项目-face++人脸识别考勤机-python_GUI-automatic_weather-face_gensui-python_game-python_LAN-python_multithreading-python_mysql-python_opencv_tracking-python_pachong
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-08-04 10:37 python项目
文件 155 2016-03-22 19:39 python项目README.md
目录 0 2017-08-09 17:03 python项目The_python_code-master
目录 0 2017-08-03 15:02 python项目automatic_weather
文件 2197 2016-03-22 19:39 python项目automatic_weather1.天气查询.py
文件 2888 2016-03-22 19:39 python项目automatic_weatherQQ图片20160120185818.png
文件 66612 2016-03-22 19:39 python项目automatic_weatherQQ图片20160120185825.jpg
文件 8098 2016-03-22 19:39 python项目automatic_weatherQQ截图20160123135304.png
文件 1836 2016-03-22 19:39 python项目automatic_weatherget_ip.py
文件 1571 2016-03-22 19:39 python项目automatic_weatherget_yuyin_hecheng.py
文件 405552 2016-03-22 19:39 python项目automatic_weathermpg123.exe
目录 0 2017-08-03 15:02 python项目automatic_weatherpicture
文件 2888 2016-03-22 19:39 python项目automatic_weatherpictureQQ图片20160120185818.png
文件 66612 2016-03-22 19:39 python项目automatic_weatherpictureQQ图片20160120185825.jpg
文件 8098 2016-03-22 19:39 python项目automatic_weatherpictureQQ截图20160123135304.png
文件 342 2016-03-22 19:39 python项目automatic_weather est.py
文件 4 2016-03-22 19:39 python项目automatic_weather est.txt
文件 2330 2016-03-22 19:39 python项目automatic_weatherurllib.request_urllib2.txt
文件 107 2016-03-22 19:39 python项目automatic_weatherweather.txt
文件 1898 2016-03-22 19:39 python项目automatic_weather天气查询.py
目录 0 2017-08-03 15:02 python项目face++人脸识别考勤机
目录 0 2017-08-03 15:02 python项目face++人脸识别考勤机LAN-jiankong
文件 355 2016-03-22 19:39 python项目face++人脸识别考勤机LAN-jiankonglianxuzhibo.py
文件 806 2016-03-22 19:39 python项目face++人脸识别考勤机LAN-jiankonglive-image-server.py
文件 929 2016-03-22 19:39 python项目face++人脸识别考勤机LAN-jiankongzhibo.py
文件 1726 2016-03-22 19:39 python项目face++人脸识别考勤机README.md
文件 1726 2016-03-22 19:39 python项目face++人脸识别考勤机README.md~
目录 0 2017-08-03 15:02 python项目face++人脸识别考勤机\__pycache__
文件 11741 2016-03-22 19:39 python项目face++人脸识别考勤机\__pycache__facepp.cpython-34.pyc
文件 3241 2016-03-22 19:39 python项目face++人脸识别考勤机admin.py
文件 219 2016-03-22 19:39 python项目face++人脸识别考勤机apikey.cfg
............此处省略495个文件信息
__author__ = ‘luyi‘
import os
import urllib.request
import urllib.parse
import json
class weather(object):
# 获取城市代码的uri
code_uri = “http://apistore.baidu.com/microservice/cityinfo?cityname=“
# 获取天气信息的uri
weather_uri = “http://apistore.baidu.com/microservice/weather?cityid=“
# 主处理逻辑
def mainHandle(self):
#city_name = input(“输入你要查询的天气:“)
fileHandle = open ( ‘test.txt‘ ‘r‘ )
city_name = fileHandle.read()
fileHandle.close()
uri = self.code_uri + urllib.parse.quote(city_name)
#获取该城市天气情况的网址
print(“查询中请等待“)
ret = json.loads(urllib.request.urlopen(uri).read().decode(“utf8“))
if ret[‘errNum‘] != 0:
print(ret[‘retMsg‘])
return False
#查询失败
else:
#查询成功使用json解析
#需要更详细信息,请看百度api的说明文档。使用方法类似。
weather_uri = self.weather_uri + ret[‘retData‘][‘cityCode‘]
data = json.loads(urllib.request.urlopen(weather_uri).read().decode(“utf8“))
if data[‘errNum‘] == 0:
ret_data = data[‘retData‘]
output = “城市名:“ + city_name + “
“
output += “更新时间:“ + ret_data[“date“] + “ “ + ret_data[“time“] + “
“
output += “天气:“ + ret_data[“weather“] + “ [“ + ret_data[“WD“] + ret_data[“WS“] + “]
“
output += “当前温度:“ + ret_data[“temp“] + “ (“ + ret_data[“h_tmp“] + “ ---> “ + ret_data[“l_tmp“] + “)
“
print(output)
fileHandle = open ( ‘weather.txt‘ ‘r‘ )
begin = fileHandle.read()
print(begin)
fileHandle = open ( ‘weather.txt‘ ‘w‘ )
fileHandle.write(output)
fileHandle.close()
return True
else:
print(data[‘errMsg‘])
return False
if __name__ == “__main__“:
weather = weather()
weather.mainHandle()
a = input(“按任意键退出“)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-08-04 10:37 python项目
文件 155 2016-03-22 19:39 python项目README.md
目录 0 2017-08-09 17:03 python项目The_python_code-master
目录 0 2017-08-03 15:02 python项目automatic_weather
文件 2197 2016-03-22 19:39 python项目automatic_weather1.天气查询.py
文件 2888 2016-03-22 19:39 python项目automatic_weatherQQ图片20160120185818.png
文件 66612 2016-03-22 19:39 python项目automatic_weatherQQ图片20160120185825.jpg
文件 8098 2016-03-22 19:39 python项目automatic_weatherQQ截图20160123135304.png
文件 1836 2016-03-22 19:39 python项目automatic_weatherget_ip.py
文件 1571 2016-03-22 19:39 python项目automatic_weatherget_yuyin_hecheng.py
文件 405552 2016-03-22 19:39 python项目automatic_weathermpg123.exe
目录 0 2017-08-03 15:02 python项目automatic_weatherpicture
文件 2888 2016-03-22 19:39 python项目automatic_weatherpictureQQ图片20160120185818.png
文件 66612 2016-03-22 19:39 python项目automatic_weatherpictureQQ图片20160120185825.jpg
文件 8098 2016-03-22 19:39 python项目automatic_weatherpictureQQ截图20160123135304.png
文件 342 2016-03-22 19:39 python项目automatic_weather est.py
文件 4 2016-03-22 19:39 python项目automatic_weather est.txt
文件 2330 2016-03-22 19:39 python项目automatic_weatherurllib.request_urllib2.txt
文件 107 2016-03-22 19:39 python项目automatic_weatherweather.txt
文件 1898 2016-03-22 19:39 python项目automatic_weather天气查询.py
目录 0 2017-08-03 15:02 python项目face++人脸识别考勤机
目录 0 2017-08-03 15:02 python项目face++人脸识别考勤机LAN-jiankong
文件 355 2016-03-22 19:39 python项目face++人脸识别考勤机LAN-jiankonglianxuzhibo.py
文件 806 2016-03-22 19:39 python项目face++人脸识别考勤机LAN-jiankonglive-image-server.py
文件 929 2016-03-22 19:39 python项目face++人脸识别考勤机LAN-jiankongzhibo.py
文件 1726 2016-03-22 19:39 python项目face++人脸识别考勤机README.md
文件 1726 2016-03-22 19:39 python项目face++人脸识别考勤机README.md~
目录 0 2017-08-03 15:02 python项目face++人脸识别考勤机\__pycache__
文件 11741 2016-03-22 19:39 python项目face++人脸识别考勤机\__pycache__facepp.cpython-34.pyc
文件 3241 2016-03-22 19:39 python项目face++人脸识别考勤机admin.py
文件 219 2016-03-22 19:39 python项目face++人脸识别考勤机apikey.cfg
............此处省略495个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)