int 和 str bool 类型 基本数据类型

一:基本数据类型 

int类型 整数

bool 布尔型 true flase

str 字符串 

list 列表

tuple 元组

dict 字典

set集合

2 int类型的操作

bit_length() 返回 二进制长度

3 bool 类型

类型转换

4 str 字符串

1 索引与切片

索引的下标从0 开始  [索引]

切片:[起始位置:结束位置:步长]

      1)顾头不顾尾

      2)默认从左往右取

     3)步长如果是负数 从右往左

2常用操作

1:upper() 变成大写字母

例如:

s = "sjdklsk"

s1 =s.upper(s)

print(s1)

结果:SJDKLSK

2:strip() 去掉左右两边的空格

如:

s = input ("")

s1.strip(s)

print(s)

3:replace()替换

4:split() 切割

5:startswith()是否以***开始

6:len()长度,内置函数

7:count(),find(),index()

3 迭代

for i in s

print(i)

原文地址:https://www.cnblogs.com/mlhz/p/9393493.html