关于系统学习测试的第一天

python 库的学习
在这里插入图片描述
在这里插入图片描述
pip国内的一些镜像

阿里云 http://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
修改源方法:
1)临时修改:
  可以在使用pip的时候在后面加上-i参数,指定pip源
  eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple

s

用{}来代替%s ,%d,%f 来输出字符串

a=1
b="aaaaaaa"
c=11
print("年龄:{2} b:{1} c:{0}".format(a,b,c))
#大括号里面写标号,从0开始,如果不编号,是按照从0开始的顺序

python 字符串的部分操作

a=1
b="aaaaaaa"
c=11
print("年龄:{2} b:{1} c:{0}".format(a,b,c))
aa="Hello World"
print(aa.upper()) #转换为大写
print(aa.lower())#转换为小写
print(aa.swapcase())#大小写互换
print(aa.replace(" " ,"@"))# 字母的替代
print(aa.find("o"))#查找字符的索引
print("^".join(aa))#每隔一个字符插入
print(aa.split("l"))#分隔

猜你喜欢

转载自blog.csdn.net/guotianxiu1234/article/details/89173817