首页
学习
活动
专区
工具
TVP
发布

艳艳代码杂货店

专栏作者
125
文章
171009
阅读量
22
订阅数
python在windows下操作word的方法
import win32com from win32com.client import Dispatch, constants w = win32com.client.Dispatch('Word.Application') 或者使用下面的方法,使用启动独立的进程: w = win32com.client.DispatchEx('Word.Application') 后台运行,不显示,不警告 w.Visible = 0 w.DisplayAlerts = 0 打开新的文件 doc = w.Documents
艳艳代码杂货店
2021-11-02
5480
python十进制转二进制,可指定位数
python十进制转二进制,可指定位数 # convert a decimal (denary, base 10) integer to a binary string (base 2) tested with Python24 vegaseat 6/1/2005 def Denary2Binary(n): '''convert denary integer n to binary string bStr''' bStr = '' if n < 0: raise Valu
艳艳代码杂货店
2021-11-02
8530
python显示生日是星期几
# find the day of the week of a given date Python will trap impossible dates like (1900, 2, 29) tested with Python24 vegaseat 01aug2005 from datetime import date a typical birthday year, month, day or change it to your own birthday... birthday = da
艳艳代码杂货店
2021-11-02
1.3K0
Python实现的hash加密小工具
[Python]代码     #!/usr/bin/env python #-*-encoding = utf-8-*- # hasher.py #@By:dengyongkai import sys import hashlib import linecache def alglist(): print """ (1)MD5 (4)SHA256 (2)SHA1 (5)SHA384 (3)SHA224 (6)SHA512 """ class hasher
艳艳代码杂货店
2021-11-02
5370
python连接Oracle数据库的代码
python连接Oracle数据库的代码,需要引用cx_Oracle库 #coding=UTF-8 import cx_Oracle def hello(): '''Hello cx_Oracle示例: 1)打印数据库版本信息. 2)查询表数据.''' conn = cx_Oracle.connect("obs61","obs61","tx8i.hp") cur = conn.cursor() t
艳艳代码杂货店
2021-11-02
1.1K0
Python3.4 PIL的使用
from PIL import Image, ImageFilter, ImageDraw, ImageFont, ImageEnhance, ImageFilter image1 = Image.open('C:/Users/hengli/Desktop/1.jpg') image2 = Image.open('C:/Users/hengli/Desktop/2.jpg') def 图片大小(image): w, h = image.size #获得图片的大小(分辨率) r
艳艳代码杂货店
2021-11-02
4570
python实现爬虫下载美女图片
[Python]代码     #-*- coding:utf-8 -*- http://www.aichengxu.com import urllib2 import re import requests from lxml import etree 这些是要导入的库,代码并没有使用正则,使用的是xpath,正则困难的童鞋可以尝试使用下 推荐各位先使用基本库来写,这样可以学习到更多 links=[]    #遍历url的地址 k=1     print u'请输入最后的页数:' endPage=int
艳艳代码杂货店
2021-11-02
3790
Python操作MySQL数据库实例
用python连接mysql的时候,需要用的安装版本,源码版本容易有错误提示。下边是打包了32与64版本。 MySQL-python-1.2.3.win32-py2.7.exe MySQL-python-1.2.3.win-amd64-py2.7.exe
艳艳代码杂货店
2021-11-02
2.1K0
python写的用WMI检测windows系统信息、硬盘信息、网卡信息
python写的用WMI检测windows系统信息、硬盘信息、网卡信息 #!/usr/bin/env python -- coding: utf-8 -- import wmi import sys,time,platform def get_system_info(os): """ 获取操作系统版本。 """ print print "Operating system:" if os == "Windows": c = wmi.WMI
艳艳代码杂货店
2021-11-02
1.1K0
bottle---Python的轻量级http server
相比于Django而言,bottle显得非常轻量级。短短几行代码即可快速搭建一个简易的http server。提供了 Python Web开发中需要的基本支持:URL路由,Request/Response对象封装,模板支持,与WSGI服务器集成支持。使用方法确实非常简便。
艳艳代码杂货店
2021-11-02
5250
python udp 服务器
import socket, traceback host = '' port = 51423 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((host, port)) while 1: try: message, address = s.recvfrom(8192) print 'G
艳艳代码杂货店
2021-11-01
1.5K0
一个简单的python读写文件脚本
#!/usr/bin/env python 'makeFile.py -- create a file' import os ls = os.linesep # get filename while True: fname = raw_input('Input an unused file name >') if os.path.exists(fname): print "ERROR: '%s' already exists" %fname
艳艳代码杂货店
2021-11-01
4240
python爬虫下载百度贴吧图片
在爬取之前需要在浏览器先登录百度贴吧的帐号,各位也可以在代码中使用post提交或者加入cookie
艳艳代码杂货店
2021-11-01
8470
用Python多线程抓取并验证代理
最后,为了提高效率,最好是使用多线程。(PS,有个地方要注意,urlopen这个函数,设定了一个全局对象opener,所以如果你使用了多个线程, 每个线程使用一个代理,那么,不能使用urlopen这个函数,而应该使用opener.open)
艳艳代码杂货店
2021-11-01
4490
python多线程多队列(BeautifulSoup网络爬虫)
程序中设置两个队列分别为queue负责存放网址,out_queue负责存放网页的源代码。
艳艳代码杂货店
2021-11-01
4020
Python3.4 远程操控电脑(开关机)
import poplib import sys import smtplib from email.mime.text import MIMEText import os from email.header import decode_header import email import time def checkemail(): try: p = poplib.POP3('pop
艳艳代码杂货店
2021-11-01
6720
通过python自动连接ssh服务器
#!/usr/bin/python -- coding:utf-8 -- import sys, time, os try: import pexpect except ImportError: print """ You must install pexpect module """ sys.exit(1) addr_map = { 'v3' :('root@192.168.1.162', 'sina@2009'), 'dev':('test
艳艳代码杂货店
2021-11-01
1.5K0
python爬取千万淘宝商品的脚本
分享之前爬虫爬到的1000万条淘宝商品信息。平衡涵盖各种分类,包括商品名、卖家id、地区、价格等信息,json格式。
艳艳代码杂货店
2021-11-01
3670
python编写简单抽奖系统
#!/usr/bin/env python coding=utf-8 from Tkinter import * import time import random class App: def init(self,master): frame = Frame(master) frame.pack() v = StringVar() self.e = Entry(frame,textvariable=v,bd='5')
艳艳代码杂货店
2021-11-01
8550
python 判断文件、文件夹是否存在
>>> import os >>> os.path.exists('d:/assist') True >>> os.path.exists('d:/assist/getTeacherList.py') True >>> os.path.isfile('d:/assist') False >>> os.path.isfile('d:/assist/getTeacherList.py') True >>> os.makedirs('d:/assist/set') >>> os.path.exists('d:/
艳艳代码杂货店
2021-11-01
2.3K0
点击加载更多
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档