Chinaunix首页 | 论坛 | 博客
  • 博客访问: 98095
  • 博文数量: 45
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 368
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-21 16:28
文章分类

全部博文(45)

文章存档

2014年(45)

我的朋友

发布时间:2014-01-26 14:18:11

import urllibfile=urllib.urlopen('http://www.baidu.com/')import urllib2file=urllib2.urlopen(test_url,timeout=10).read()urllib与urllib2区别:可以把urllib2当作urllib的扩增,比较明显的优势是urllib2.urlopen可以接受Request对象作为参数,从而可以控制HTTP Request的header部。做HTTP Request时应当.........【阅读全文】

阅读(394) | 评论(0) | 转发(0)

发布时间:2014-01-26 14:13:36

import sys args=sys.argv[1:]args[0],args[1],args[2]例如:运行脚本:common.pypython common.py "url" "<product_id>"  "</product_id>"其中:“url”为args[0]"<product_id>"为args[1]"</product_id>"为args[2]......【阅读全文】

阅读(314) | 评论(0) | 转发(0)

发布时间:2014-01-26 14:04:09

1. 逐行读取某文件,将每行的内容作为一个元素放到一个列表中:lst=[]while True:    r=file.readline()    if len(r) ==0 :        break    elif r.count('\n') ==len(line):        continue    else:&n.........【阅读全文】

阅读(1197) | 评论(0) | 转发(0)

发布时间:2014-01-22 15:15:56

 json 格式的例子:{ "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": 10021 }, "phoneNumbers": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-456.........【阅读全文】

阅读(233) | 评论(0) | 转发(0)

发布时间:2014-01-22 12:57:53

下面是例子分析表A记录如下: aID        aNum 1           a20050111 2           a20050112 3      .........【阅读全文】

阅读(440) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册