![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
苍月枫
linux
展开
-
Python strip、rstrip、lstrip的区别
rstrip和strip是python字符串中的方法。 rstrip函数返回字符串副本,该副本是从字符串最右边删除了参数指定字符后的字符串,不带参数进去则是去除最右边的空格。 而strip方法和rstrip的功能一样,不同之处是它是同时去除左右两边指定的字符。 案列1: 在不加参数的情况下,2个函数默认都是去除空格>>> " hello ".strip翻译 2018-06-28 15:56:02 · 3113 阅读 · 1 评论 -
Python中字符串大小写切换
lower()、upper()、capitalize()、title()、swapcase() 这几个方法分别用来将字符串转换为小写、大写字符串、将字符串首字母变为大写、将每个首字母变为大写以及大小写互换, 这几个方法都是生成新字符串,并不对原字符串做任何修改s='What is Your Name?'s2=s.lower()print(s2) #返回小写字符串# what is...转载 2018-06-28 17:02:49 · 3154 阅读 · 0 评论 -
Python模块之time
#encoding=utf-8import time# 返回时间戳print time.time()# 延迟运行单位为s,如下为延迟3stime.sleep(3)# 转换时间戳为时间元组(时间对象),自1970+second,其second为秒数print time.gmtime(4)# 转换时间戳为本地对象print time.localtime()# 将时间戳转换...转载 2018-06-28 17:10:21 · 158 阅读 · 0 评论 -
CentOS 7 安装python 3
系统环境: CentOS Linux release 7.5.1804 (Core)一、配置yum源1. 添加yum源vim /etc/yum.repos.d/gitlab-ce.repo#输入以下内容[gitlab-ce]name=Gitlab CE Repositorybaseurl=https://mirrors.tuna.tsinghua.edu.cn/g...原创 2018-07-18 09:50:19 · 233 阅读 · 0 评论 -
Python安装模块错误记录
1. 安装MySQL-python报错情况:pip3 install MySQL-pythonCollecting MySQL-python Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/...转载 2018-07-13 14:00:53 · 820 阅读 · 0 评论