代码:#coding=utf-8from selenium import webdriverdriver=webdriver.Chrome() #调用chrome浏览器driver.get('https://www.baidu.com')print driver.titledriver.quit(....
分类:
编程语言 时间:
2015-03-30 13:11:17
阅读次数:
231
join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。str.join(sequence)>>> str = ''>>> seq = ['abc','def']>>> print str.join(seq)abcdef>>> str = '-'>>>seq=('abc','def'...
分类:
编程语言 时间:
2015-03-30 12:58:50
阅读次数:
202
代码如下:#coding=utf-8from selenium import webdriverdriver=webdriver.Ie()driver.get('https://www.baidu.com')print driver.titledriver.quit()报错:Traceback (m...
分类:
其他好文 时间:
2015-03-30 12:55:28
阅读次数:
116
Python装饰器学习(九步入门)这是在Python学习小组上介绍的内容,现学现卖、多练习是好的学习方式。第一步:最简单的函数,准备附加额外功能?12345678# -*- coding:gbk -*-'''示例1: 最简单的函数,表示调用了两次'''def myfunc(): print("myf...
分类:
编程语言 时间:
2015-03-30 10:48:14
阅读次数:
168
Step 1: 新建一个模块化函数,命名为am.py
def add(x,y):
return x + y
def minus(x,y):
return x - y
Step 2: 新建一个测试函数testam.pyimport am
print am.add(10,30)
Step 3:运行,测试结果如下:
>>> =========================...
分类:
编程语言 时间:
2015-03-29 22:13:53
阅读次数:
209
仿照http://blog.csdn.net/lming_08/article/details/44710779里面的方法, 获取指定URL 的所需的子链接及其描述.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import urllib2
import re
if len(sys.argv) != 2:
print ...
分类:
Web程序 时间:
2015-03-29 20:59:09
阅读次数:
170
第一步:最简单的函数,准备附加额外功能#-*-coding:gbk-*-'''示例1:最简单的函数,表示调用了两次'''defmyfunc():print("myfunc()called.")myfunc()myfunc()第二步:使用装饰函数在函数执行前和执行后分别附加额外功能#-*-coding...
分类:
编程语言 时间:
2015-03-29 17:49:56
阅读次数:
161
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers.You may ...
分类:
其他好文 时间:
2015-03-29 15:05:21
阅读次数:
115
How would you print just the 10th line of a file?For example, assume that file.txt has the following content:Line 1Line 2Line 3Line 4Line 5Line 6Line ...
分类:
其他好文 时间:
2015-03-29 14:57:51
阅读次数:
88
让ECHO变快, 让PHP的请求处理过程, 尽快结束, 之所以ECHO慢, 是在等待”写数据”成功返回, 那么一个比较简单的办法, 就是打开输出缓存,编辑php.inioutput_buffering = 4096 //bytes也可以在脚本中, 显示的调用ob_start():ob_start()...
分类:
Web程序 时间:
2015-03-29 14:49:50
阅读次数:
156