第一个python脚本
2011-03-04 12:34
357 查看
看Python基础教程一段时间了。但是一直也没有写个脚本。只是看,昨天写了一个简单至极Python脚本竟然用了2个小时。哭~~~,以后还是得多写!另外得买本Python编程的基础书籍边看边写,巩固基础。
#!/usr/bin/python
import os
import time
cmd = 'curl -so page.html "http://www.sina.com.cn" '
while 1:
start = time.time()
os.popen(cmd)
elapsed = (time.time() - start)
now = time.strftime('[%Y-%m-%d %H:%M:%S]',time.localtime(time.time()))
log_format = '%s %s\n'%(now,elapsed)
log = open('pytime.log','a')
log.write(log_format)
time.sleep(5)
#!/usr/bin/python
import os
import time
cmd = 'curl -so page.html "http://www.sina.com.cn" '
while 1:
start = time.time()
os.popen(cmd)
elapsed = (time.time() - start)
now = time.strftime('[%Y-%m-%d %H:%M:%S]',time.localtime(time.time()))
log_format = '%s %s\n'%(now,elapsed)
log = open('pytime.log','a')
log.write(log_format)
time.sleep(5)
相关文章推荐
- 人生第一个python脚本:从数据库查询数据并发送邮件
- python的第一个脚本
- 怎样开始写第一个基于python的selenium脚本
- selenium python 第一个脚本
- python-webdriver 开始第一个脚本
- 我的第一个python爬虫脚本
- python+robotframework --第一个UI自动化脚本
- Python 爬虫3——第一个爬虫脚本的创建
- selenium_webdriver(python)的第一个脚本
- selenium+python3.6学习——第一个脚本
- 学习shell的时候 第一个脚本就是ping监控 python版
- 运行第一个python简单hello world脚本
- python+selenium 编写第一个自动化脚本 Ie版
- 第一个python脚本
- 第一个Python脚本之:Hello World
- [TPYBoard - Micropython之会python就能做硬件 1] 运行第一个脚本——点亮LED
- python基础之编写第一个python脚本
- 2、Selenium + Python 实现 UI 自动化测试-第一个自动化测试脚本
- 【python+selenium】第一个pythonselenium自动化脚本
- Python 爬虫3——第一个爬虫脚本的创建