
python
jjt_!!
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python远程连接服务器
python远程连接服务器转载 2023-02-01 19:07:30 · 1163 阅读 · 0 评论 -
python调用fastdfs
python fastdfs原创 2022-08-24 16:40:50 · 1178 阅读 · 0 评论 -
python生成随机数
random.sample原创 2022-07-15 19:17:30 · 1120 阅读 · 0 评论 -
python3--requests
requests是一个简单的python 的http库.本文档整理了一些简单的用法。cookies,重定向,以及一些高级用法没有整理 安装 pip install requests 请求参数 参数 用途 备注 params get请求传递参数 字典,字典的value为列表 data post请求传递参数 字典,元组列表,字典的value为列表 headers 传递头信息,字典形式。类型为str,字节字符串或unicode json post请求使用,传递未编码的参数 jso.原创 2021-02-04 10:31:42 · 364 阅读 · 0 评论 -
日志-python3
python3的日志模块为内置模块,logging 使用案例: import logging logging.basicConfig(filename='log.log',format='%(asctime)s log-[%(levelname)s]: %(message)s',level=logging.INFO) logging.info('log level info') 执行上述代码,输出为: 2021-01-28 17:41:28,210 root-[INFO]: log level inf原创 2021-01-28 17:45:57 · 256 阅读 · 1 评论 -
使用镜像下载安装包
因提供的默认镜像无法访问,故下载时可指定镜像下载: pip install confluence -i https://pypi.douban.com/simple 修改镜像长久生效的方式: 修改配置文件,路径为(该文件我没有找到): 在unix和macos,配置文件为:$HOME/.pip/pip.conf 在windows上,配置文件为:%HOME%\pip\pip.ini 2.添加内容: [global] index-url=http://mirrors.tuna.tsinghua.edu.原创 2021-01-23 15:40:52 · 366 阅读 · 0 评论 -
邮件发送
利用邮件模块,模拟发送邮件的过程 #!/usr/bin/python # -*- coding: utf-8 -*- import smtplib from email.mime.text import MIMEText from email.header import Header from config import emailc def send_mail(context=None,host=emailc.host,sender=emailc.sender,receivers=emailc.原创 2021-01-29 09:38:56 · 213 阅读 · 0 评论 -
web框架--bottle
示例: from bottle import route,run,template @route('/dps/slave/:entid#[0-9]+#') def DpsPushConfigInfo(entid=None): keys = "getDpsPushConfigInfo:hset:getConfigHash:" + entid content = list() for field in cli.hkeys(keys): content.append([k原创 2021-02-01 15:47:22 · 355 阅读 · 0 评论 -
python3 类型转换(str,bytes,dict)
# bytes object b = b"example" # str object s = "example" # str to bytes bytes(s, encoding = "utf8") # bytes to str str(b, encoding = "utf-8") # an alternative method # str to bytes str.encode(s) # bytes to str bytes.decod.原创 2021-01-23 15:11:23 · 1956 阅读 · 0 评论 -
http server
顾名思义:提供http协议的服务端 python2使用方法: python -m SimpleHTTPServer python -m SimpleHTTPServer 1234 第一条命令直接启动,默认端口8000,网络全网广播 第二条命名指定端口1234绑定 python3的使用方法: python -m http.server 8000 和python2一样的道理 ...原创 2021-01-23 15:09:31 · 93 阅读 · 0 评论 -
zip的使用
zip函数接受任意多个(包括0个和1个)序列作为参数,返回一个tuple列表 zip 方法在 Python 2 和 Python 3 中的不同:在 Python 3.x 中为了减少内存,zip() 返回的是一个对象。如需展示列表,需手动 list() 转换。 “Return a list of tuples, where each tuple contains the ith element from each of the argument sequences. The returned list is原创 2021-01-23 15:08:53 · 275 阅读 · 0 评论 -
Python2学习笔记(4)
条件选择和循环原创 2016-06-02 11:03:42 · 254 阅读 · 0 评论 -
Python2学习笔记(1)
python是用来编写程序的高级编程语言,其适用范围如下: 编写网站、后台服务等网站应用; 编写日常需要的小工具,包括脚本任务等; 将其他语言开发的程序包装起来,方便应用。 python有大量的基础库,容易编写。缺点有: 运行速度慢 不能加密 python文件的运行python有命令行模式和交互模式两种运行代码的环境。 在交互模式下(在命令行模式下,输入python回车即可跳转到该模式):直接输入原创 2016-05-24 23:47:34 · 289 阅读 · 0 评论 -
Python2学习笔记(3)
list Python内置的一种数据类型列表,是一种有序的集合。可随时增加和删除元素。list是一种有序的集合,写在中括号中。 >>> name ['a', 'b', 'c'] >>> grade = [12,34,10] >>> grade [12, 34, 10]用len()函数可以获得list的长度 >>> len(grade) 3 >>> a =[] #空的list,长度为0 >>> l原创 2016-05-29 17:50:57 · 275 阅读 · 0 评论 -
Python2学习笔记(2)
python基本语法 python语法采用缩进形式,一般使用tab键或4个空格。一般情况下,不要混用这两种缩进格式,可能会报错 当语句以“:”结束时,缩进的语句视为代码块 pyhon程序是大小写敏感的 数据类型 python 中可以直接处理的数据类型包括整数、浮点数、字符串、布尔值、空值。此外,python还提供了list、字典等数据类型。同时也允许自定义数据类型。 整数原创 2016-05-25 11:38:15 · 341 阅读 · 0 评论