#codeing:utf-8import os#搞定WINDOWS下所有系统路径filename=‘c:\\WINDOWS_ALL_PATH.txt‘f=open(filename,‘w‘)i=1for path_name in os.environ.keys(): f.write(‘{0:0>2}‘.format(i)+". "+‘{0: <30}‘.format(path_name)) f.write(" "+os.environ[path_name]) f.write(‘\r\n‘) i+=1f.close()原文:https://www.cnblogs.com/dengpeiyou/p/9246241.html
原文:http://blog.51cto.com/6850242/2125862
# -*- coding:utf-8 -*-import json
import xlwt
from datetime import datetime
import time
import os
import urllib.request
import urllib.parse
from urllib.parse import quote
import arcpy
import chardet
import stringcos=[r‘xxx关厂有限公司‘,
r‘xxx铝业有限公司‘]time.sleep(0.5)headers = {#‘User-Agent‘:‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version...
有时候使用到获取本机IP,就采用以下方式进行。复制代码 代码如下:
#!/usr/bin/python
import socket
import struct
import fcntl
def getip(ethname):
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0X8915, struct.pack(‘256s‘, ethname[:15]))[20:24])
if __name__==‘__main__‘:
print getip(‘eth0‘)原文:http://www.jb51.net/article/57201.htm
前言今天没妹子约,刚好研究一下。如何用神奇的python打造一个把妹神器吧。看完这个,你们就能走向人生巅峰,迎娶白富美啦。我知道你们想看看效果当然啦,这只是测试版的效果,真正的版本可比这个厉害多啦。不过作为一个直男,另一个男的给小编发这个测试感觉还是有点怪怪的哈。文:吉柏言暑假来了,各位又不得不和男女朋友暂时分开2个月了!!长达两个月的时间里不能相见,你可知我多想你啊,想知道你的城市下雨了吗,想知道你带伞...
Python获取并输出当前日期时间学习了:https://www.cnblogs.com/kerwinC/p/5760811.htmltime.strftime(‘%Y-%m-%d %H:%M:%S‘,time.localtime(time.time())) 原文:https://www.cnblogs.com/stono/p/9095382.html
1. 定位及获取目标元素
由于这是一个structured data,而且有一定的层次,鉴于需要较快完成信息的整理,所以并没有另外新学structured data信息的爬取(以后再说QAQ)如果简单的复制粘贴的话,会变成以下模样...
(可能要改好久的换行符,我不!!!)那首先直接抓取最多的元素,省去最多的劳动力
在检查元素后发现,像01100Metabolic pathways这样的元素都分组到某个list中,那么直接driver.find_elements_by_class_name(‘list‘...
platform模块提供了底层系统平台的相关信息系统架构32位还是64位>>>import platform
>>> platform.architecture()
(‘64bit‘,‘ELF‘)# python 3.3.2+ 64 bits on debian jessie 64 bits
(‘32bit‘,‘WindowsPE‘)# python 3.3.2 32 bits on windows 8.1 64 bits
(‘64bit‘,‘WindowsPE‘)# python 3.3.2 64 bits on wndows 8.1 64 bits
(‘64bit‘, ‘‘)# python 3.4.1 64 bits on mac os x 10.9.4 ELF和WindowsPE是可执行文件...
本文实例讲述了python获取从命令行输入数字的方法。分享给大家供大家参考。具体如下:
#----------------------------------------
# Name: numerical_input.py
# Author: Kevin Harris
# Last Modified: 02/13/04
# Description: This Python script demonstrates
# how to get numerical input
# from the command line
# and use the if-else conditional.
#-----------------------------...
由于一直使用python3进行编码,在使用Python2时,将爬虫数据连接数据库进行存储时,出现如上的报错,经查资料 是数据库编码问题。如下转自:http://www.cnblogs.com/liuzhixin/p/6274821.html 的博客,在此感谢博主的慷慨分享之情。 错误原因:我们可以看到错误提示中的字符0xF0 0x9F 0x98 0x84 ,这对应UTF-8编码格式中的4字节编码(UTF-8编码规范)。正常的汉字一般不会超过3个字节,为什么为出现4个字节呢?实际上是它对应的是...
代码
#Author Kang
#获取ESXI主机的CPU和内存使用情况,并统计百分比import ssl
import pysphere
from pysphere import VIServer,MORTypes,VIProperty
from pysphere.resources import VimService_services as VIssl._create_default_https_context = ssl._create_unverified_context
host_ip = ‘10.3.151.2‘
username = ‘root‘
passwd = ‘password‘ s = VIServer()
s.connect(host_ip,usern...
当然 需要引入 datetimeimport datetime获取当前日期:datetime.datetime.now().strftime(‘%Y-%m-%d‘)获取当前日期前七天日期: now_time = datetime.datetime.now() yes_time = now_time + datetime.timedelta(days=-7) yes_time_nyr = yes_time.strftime(‘%Y-%m-%d‘) 原文:http://www.cnblogs.com/aiyr/p/6547767.html
#当前一周 def week_get_now(self): import datetimed = datetime.datetime.now()dayscount = datetime.timedelta(days=d.isoweekday()) dayto = dsixdays = datetime.timedelta(days=6) dayfrom = dayto - sixdays date_from = datetime.datetime(dayfrom.year, dayfrom.month, dayfrom.day, 0, 0, 0) date_to = datetime.datetime(dayto.year, dayto.month, dayto.day, 23, 59, 59) return str(date_from), str(date_to) #...
最近在弄zabbix监控MySQL事宜,发现shell脚本无法解决字符串转换为整数操作,于是想到了Python,这里就用Python3环境首先安装pymysqlpip install pymysql 1#!/usr/bin/env python 2# -*- coding: utf8 -*- 3import pymysql4 mysql_connect = pymysql.connect(host=‘192.168.3.5‘,user=‘root‘,passwd=‘123456‘,port=3306,db=‘mysql‘,charset = ‘utf8‘)5 cur = mysql_connect.cursor()6 cur.execute("show global status")...
接口:daily_basic更新时间:交易日每日15点~17点之间描述:获取全部股票每日重要的基本面指标,可用于选股分析、报表展示等。积分:用户需要至少300积分才可以调取,具体请参阅本文最下方积分获取办法注:tushare库下载和初始化教程,请查阅我之前的文章输入参数名称 | 类型 | 必选 | 描述ts_code | str | Y | 股票代码(二选一)trade_date | str ...