python刷新页面
是在IDLE中? 清空当前屏幕就可以了 cls , 或者你就重新赋值,默认会自动覆盖的
2. python 如何实现局部刷新功能
ajax, 具体请网络
3. 关于Python界面信息自动刷新
fromtkinterimport*
importtime
defupdatetimer():
timer=time.strftime("%H:%M:%S")
timelabel.configure(text=timer)
timelabel.after(1000,updatetimer)
root=Tk()
timelabel=Label(root)
timelabel.pack()
timelabel.after(1000,updatetimer)
root.mainloop()
4. 怎样能够用python 刷新网页
用urlopen和time组合一下呗,我一菜鸟只想到回这个答
#!/usr/bin/env python
#coding=utf-8
import urllib2
html = urllib2.urlopen("http://****",timeout = 30).read()
print html.decode("gbk").encode("utf-8")
5. Python中ttk的界面刷新问题
一个建议的抄编程思想:
通过一个可变变量来传递任务完成的进度,例如可变变量命名为p,(p位于0到1之间,表示百分比。)
主程序显示一个progressbar,其值为p。
DoJob()在运行过程中会更改p的值。
则此更改在mainloop()的作用下将实时显示到progressbar上。
6. 刷新网页服务器怎么回复python
不管是什么语言,ajax请求的都是一个后端地址,也就是一个web系统,需要搭建一个web系统来响应请求的,python也有这样的web开发系统,比如django或者flask都能实现!
7. 用python怎么不刷新网页而监控网页变化
在浏览器第一次请求某一个URL时,服务器端的返回状态会是200,内容是你请求的资源,同时有一个Last-Modified的属性标记此文件在服务期端最后被修改的时间,格式类似这样:
Last-Modified: Fri, 12 May 2006 18:53:33 GMT 客户端第二次请求此URL时,根据 HTTP
协议的规定,浏览器会向服务器传送 If-Modified-Since 报头,询问该时间之后文件是否有被修改过:
If-Modified-Since: Fri, 12 May 2006 18:53:33 GMT
如果服务器端的资源没有变化,则自动返回 HTTP 304 (Not
Changed.)状态码,内容为空,这样就节省了传输数据量。当服务器端代码发生改变或者重启服务器时,则重新发出资源,返回和第一次请求时类似。从而保证不向客户端重复发出资源,也保证当服务器有变化时,客户端能够得到最新的资源。
headers'If-Modified-Since'
Status Code:304 Not Modified
状态码 304 表示页面未改动
>>> import requests as req>>> url='http://www.guancha.cn/'>>> rsp=req.head(url,headers={'If-Modified-Since':'Sun, 05 Feb 2017 05:39:11 GMT'})>>> rsp<Response [304]>>>> rsp.headers
{'Server': 'NWS_TCloud_S1', 'Content-Type': 'text/html', 'Date': 'Sun, 05 Feb 2017 05:45:20 GMT', 'Cache-Control': 'max-age=60', 'Expires': 'Sun, 05 Feb 2017 05:46:20 GMT', 'Content-Length': '0', 'Connection': 'keep-alive'}
时间改为 昨天(4号)
服务器返回状态码200
并且有'Last-Modified': 'Sun, 05 Feb 2017 06:00:03 GMT'
表示 最后修改的时间。
>>> hds={'If-Modified-Since':'Sat, 04 Feb 2017 05:39:11 GMT'} # 时间改为 昨天(4号)>>> rsp=req.head(url,headers=hds)>>> rsp<Response [200]>>>> rsp.headers
{'Last-Modified': 'Sun, 05 Feb 2017 06:00:03 GMT', 'Date': 'Sun, 05 Feb 2017 06:04:59 GMT', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'X-Daa-Tunnel': 'hop_count=2', 'X-Cache-Lookup': 'Hit From Disktank3 Gz, Hit From Inner Cluster, Hit From Upstream', 'Server': 'nws_ocmid_hy', 'Content-Type': 'text/html', 'Expires': 'Sun, 05 Feb 2017 06:05:59 GMT', 'Cache-Control': 'max-age=60', 'Content-Length': '62608'}>>>
8. 用python隔几分钟刷新一次网页,要怎么做
用urlopen和time组合一下呗,我一菜鸟只想到这专个属 #!/usr/bin/env python #coding=utf-8 import urllib2 html = urllib2.urlopen("http://****",timeout = 30).read() print html.decode("gbk").encode("utf-8")