python第二部分
什么数据类型?
int 1, 2, 3 用来运算的
float 1.2 str 用来存储一定的信息"" '' list =[1,2 ,3 "有", 是]用来存储大量的信息
touple(1,2, 3,) 用来存储不变的列表,只能读 dic ={"我":"金燎源" "你" : "北京"} 用来存储数据关系,方便查找
set = {1, 2, 3, 4} 求集合的差集,并集,交集 #字符串的大写
#字符串的操作 # s = 'alexWusir'
# # s1 = s.capitalize()
# # print(s1)
#
# #大写,小写
# s2 = s.upper()
# s3 = s.lower()
#
# print(s2, s3) # s_str = 'acEQ'
#
# your_input = input("请输入验证码,不区分大小写:")
#
# if s_str.lower()== your_input.lower():
# print("输入成功")
# else:
# print("请重新输入") #大小写翻转
# s = "Alex Wusir"
#
# s3 = s.swapcase()
# print(s3)
#每个隔开的单词首字母大写
# s = "alex wusir"
# s4 = s.title()
# print(s4)
#居中
# s = "alexWusir"
#
# s5 = s.center(20,'*')
# print(s5) #公共办法
# s = "alex二高"
#
# l = len(s)
# print(l) #以什么开头
# s = "alexyouaresogood"
# s7 =s.startswith("alex")
# s7 =s.startswith("ex", 2,3)
# print(s7)
#find 可以索引,找不到返回-1
#index通过元素找索引,找不到报错
# s = "alexWusWir"
# s8 = s.index("A")
# print(s8, type(s8))
#rstrip从右边开始删除,lstrip从左边开始删除
# s = "*** Alex wusir %%%"
# s9= s.strip("*% ")
# print(s9) # s = "alexaa wusrila"
# s10 = s.count("a")
#
# print(s10) #split 将字符串分割成列表
#
# s = "alexl wusir;lambaba"
# l = s.split("a")
#
# print(l)
#
# s = "我叫{name}, 今年是{age}, 爱好{hobb}, 再说一下我叫{name}".format(name="太白",age=23,hobb="girl")
# print(s) # s = "来看待街坊邻居街坊的事情"
# s10 = s.replace("街坊","老王",1)
# print(s10) s = "siidjaijdlakdla" # for i in s:
# print(i) s = "fadacandadjik苍井空ksdalks" # if "苍井空"not in s:
# print("你的评论有敏感词") # s = "123e2"
# print(float(s)) li = [1,'a','b',2,3,'a']
# li.insert(0,55) #按照索引去增加
# print(li) # li.append('aaa') #增加到最后
# li.append([1,2,3]) #增加到最后
# print(li) # li.extend(['q,a,w']) #迭代的去增
# li.extend(['q,a,w','aaa'])
# li.extend('a')
# li.extend('abc')
# li.extend('a,b,c')
# print(li)
#
# li.extend(['q,a,w'])
# li.extend('qwa')
# print(li) li = [1, 2, 3, 4] # l1 = li.pop(1)
# print(l1) # del li[1:3]
# print(li) # li.remove(2)
# print(li) # li.clear()
# print(li) #改正
lst = [1, 2, 3, 4, 3] # lst[1] = "asbd"
# print(lst)
# lst[1:3] = ['a', 'b']
# print(lst)
# a = [1,2,3 ,45,3,3]
# # print(a.count(3))
# print(a.index(3)) a = [1,3,43,45,2,123,34,34] # s10 = a[5:0:-1]
s10 = a[-1: :-1]
print(s10)
# a.sort(reve
# rse=True)
# print(a)
# a.reverse()
# print(a)
python第二部分的更多相关文章
- selenium webdriver (python) 第二版
前言 对于大多软件测试人员来讲缺乏编程经验(指项目开发经验,大学的C 语言算很基础的编程知识)一直是难以逾越的鸿沟,并不是说测试比开发人员智商低,是国内的大多测试岗位是功能测试为主,在工作时间中,我们 ...
- 简学Python第二章__巧学数据结构文件操作
#cnblogs_post_body h2 { background: linear-gradient(to bottom, #18c0ff 0%,#0c7eff 100%); color: #fff ...
- Python第二十四天 binascii模块
Python第二十四天 binascii模块 binascii用来进行进制和字符串之间的转换 import binascii s = 'abcde' h = binascii.b2a_hex(s) # ...
- Python第二十二天 stat模块 os.chmod方法 os.stat方法 pwd grp模块
Python第二十二天 stat模块 os.chmod方法 os.stat方法 pwd grp模块 stat模块描述了os.stat(filename)返回的文件属性列表中各值的意义,根据 ...
- Python第二十六天 python装饰器
Python第二十六天 python装饰器 装饰器Python 2.4 开始提供了装饰器( decorator ),装饰器作为修改函数的一种便捷方式,为工程师编写程序提供了便利性和灵活性装饰器本质上就 ...
- Python第二天 变量 运算符与表达式 input()与raw_input()区别 字符编码 python转义符 字符串格式化 format函数字符串格式化 帮助
Python第二天 变量 运算符与表达式 input()与raw_input()区别 字符编码 python转义符 字符串格式化 format函数字符串格式化 帮助 目录 Pychar ...
- python第二十九课——文件读写(复制文件)
自定义函数:实现文件复制操作有形参(2个) 没有返回值相似版(不用) def copyFile(src,dest): #1.打开两个文件:1个关联读操作,1个关联写操作 fr=open(src,'rb ...
- python第二十九课——文件读写(读取读取中文字符)
演示:读取中文字符 结论: 1).如果不设置encoding,默认使用gbk进行编解码 2).如果编码和解码不一致,最终导致报错,但是一旦设置了errors='ingore',那么就不会报错,而采取乱 ...
- 孤荷凌寒自学python第二十九天python的datetime.time模块
孤荷凌寒自学python第二十九天python的datetime.time模块 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) datetime.time模块是专门用来表示纯时间部分的类. ...
- 孤荷凌寒自学python第二十八天python的datetime.date模块
孤荷凌寒自学python第二十八天python的datetime.date模块 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) 一.toordinal() 此方法将访问从公元1年1月1日至当 ...
随机推荐
- P4149 [IOI2011]Race 点分治
思路: 点分治 提交:5次 题解: 刚开始用排序+双指针写的,但是调了一晚上,总是有两个点过不了,第二天发现原因是排序时的\(cmp\)函数写错了:如果对于路径长度相同的,我们从小往大按边数排序,当双 ...
- pyecharts v1 版本 学习笔记 折线图,面积图
折线图 折线图 基本demo import pyecharts.options as opts from pyecharts.charts import Line c = ( Line() .add_ ...
- phpweb文件上传下载
PHP用超级全局变量数组$_FILES来记录文件上传相关信息的. 1.file_uploads=on/off 是否允许通过http方式上传文件 2.max_execution_time=30 允许脚本 ...
- docker 1.12
curl https://releases.rancher.com/install-docker/1.12.sh | sh http://rancher.com/docs/rancher/v1.6/e ...
- ie8 ajax 跨域问题
最近做了个客服端要通过ocx获得初始化数据就是一个html页面镶嵌在一个c++做的程序里面通过c++做的程序的一个按钮来打开我的这个html页面但是页面中的ajax就是用不了又不报错 后来加入了cro ...
- wordpress爆破脚本的编写
import requests import sys import queue import threading import time import getopt urll='' users='' ...
- redis数据结构有哪些
1.String 可以是字符串,整数或者浮点数,对整个字符串或者字符串中的一部分执行操作,对整个整数或者浮点执行自增(increment)或者自减(decrement)操作. 2.list 一个链表, ...
- MyBatis入门使用
MyBatis入门使用 MyBatis简介 MyBatis是支持普通SQL查询.存储过程和高级映射的持久层框架.MyBatis消除了几乎所有的JDBC代码和参数的手工设置以及结果集的检索.MyBati ...
- PHP多进程开发与Redis结合实践
原文:https://blog.51cto.com/laok8/2107892?source=drh 业务逻辑介绍: 用户在 APP 上发帖子,然后存储到 Redis 的 List 列表中 利用 Li ...
- shell命令:getevent和sendevent
1.getevent 输出所有event设备的基本信息 输出格式: 设备名: 事件type 事件code 事件value 注意:这里的数字都是16进制. getevent -c 10 //输出10条信 ...