基本数据类型(一)

 

一、数字

整形  int:

#在32位机器上,整数的位数为32位,取值范围为-2**31~2**31-1,即-2147483648~2147483647
#在64位系统上,整数的位数为64位,取值范围为-2**63~2**63-1,即-9223372036854775808~9223372036854775807

可将字符串转为数字:


二、布尔值

True、False

0    、 1

 

三、字符串(比较重要的:join/find/split/strip/upper/lower/replace等)

字符串常用功能:

  • 移除空白(strip)
  • 分割(split)
  • 索引

  • 切片

  •  长度

 1、 capitalize

 

 

 2、casefold

 

3、center

 4、count

 

 5、startswith

       endswith

 

6、find

 7、format

 

8、isalnum

9、expandtabs

10、isalpha

11、isdecimal

 

12、isprintable

 13、isspace

 

14、istitle     title

15、join(重要)

 16、ljust     rjust

 

 17、islower       lower

 

 18、isupper   upper

 

19、lstrip    rstrip    strip

20、maketrans

21、partition       rpartition

22、split        rsplit

23、splitlines

24、startswith    endswith

 

25、swapcase

 

26、replace

原文地址:https://www.cnblogs.com/chengweizhong/p/8413235.html