摘要: #coding=utf-8 import MySQLdb # 打开数据库连接 db = MySQLdb.connect(host='localhost',user='root',passwd='',db ='company') # 使用cursor()方法获取操作游标 cursor = db.cur 阅读全文
posted @ 2017-04-07 11:08 yuuwee 阅读(255) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import W... 阅读全文
posted @ 2017-03-28 16:52 yuuwee 阅读(31315) 评论(0) 推荐(4) 编辑
摘要: 1.先看一下cookie是啥 cookie是访问web时服务器记录在用户本地的一系列用户信息(比如用户登录信息),以便对用户进行识别 得到如下打印 列表中为所有cookie,不同的cookie在其中各字典中 name:cookie的名称 value:cookie对应的值,动态生成的 domain:服 阅读全文
posted @ 2017-03-24 11:06 yuuwee 阅读(6397) 评论(1) 推荐(1) 编辑
摘要: 遍历hao123中某一区域的所有链接,点击每个链接时,会打开新的窗口,获取新窗口的title后关闭窗口,切换到初始窗口继续打开下一个链接 代码如下: 不妥之处请指正 阅读全文
posted @ 2017-03-16 17:03 yuuwee 阅读(2391) 评论(0) 推荐(0) 编辑
摘要: 打开hao123首页,需要定位以上区域中的所有链接,他们有相同的父元素<ul class="js_bd site-bd site-hd0">,所有链接处在li>a标签下 如下操作 阅读全文
posted @ 2017-03-16 14:16 yuuwee 阅读(5045) 评论(0) 推荐(0) 编辑
摘要: 把目录 E:\ 下面所有 后缀名为 .py 的 文件复制到 E:\PyLearn 阅读全文
posted @ 2016-07-21 15:26 yuuwee 阅读(355) 评论(0) 推荐(0) 编辑
摘要: #coding:utf-8 import os import shutil #将aaa.txt的内容复制到bbb.txt shutil.copy('aaa.txt','bbb.txt') #将aaa.txt复制到目录 shutil.copy('aaa.txt','./a') #移动文件或目录 shutil.move('aaa.txt','bbb.txt') shutil.move('aaa... 阅读全文
posted @ 2016-07-19 15:58 yuuwee 阅读(209) 评论(0) 推荐(0) 编辑
摘要: #coding utf-8 import os def main(): fileDir = 'F:'+os.sep+'aaa' for root,dirs,files in os.walk(fileDir): print (root) print (dirs) print (files) os.system('pause'... 阅读全文
posted @ 2016-07-14 17:10 yuuwee 阅读(151) 评论(0) 推荐(0) 编辑