python 类型解析

基本数据类型:
 
1、数字
int(整型)
  在32位机器上,整数的位数为32位,取值范围为-2**31~2**31-1,即-2147483648~2147483647
  在64位系统上,整数的位数为64位,取值范围为-2**63~2**63-1,即-9223372036854775808~9223372036854775807
 
class int(object): def bit_length(self): """ 返回表示该数字的时占用的最少位数 """ """ int.bit_length() -> int Number of bits necessary to represent self in binary. >>> bin(37) '0b100101' >>> (37).bit_length() 6 """ return 0
 
def conjugate(self, *args, **kwargs): # real signature unknown """ 返回该复数的共轭复数 """ """ Returns self, the complex conjugate of any int. """ pass
 
2、布尔值
  真或假
  1 或 0
3、字符串
"hello world"
字符串常用功能:
  • 移除空白
  • 分割
  • 长度
  • 索引
  • 切片
def capitalize(self): """ 首字母变大写 """
 
def center(self, width, fillchar=None): """ 内容居中,width:总长度;fillchar:空白处填充内容,默认无 """
 
 
def count(self, sub, start=None, end=None): """ 子序列个数 """
 
 
 
def endswith(self, suffix, start=None, end=None): """ 是否以 xxx 结束 """
 
 
def expandtabs(self, tabsize=None): """ 将tab转换成空格,默认一个tab转换成8个空格 """
 
 
 
def find(self, sub, start=None, end=None): """ 寻找子序列位置,如果没找到,返回 -1 """
 
def format(*args, **kwargs): # known special case of str.format """ 字符串格式化,动态参数,将函数式编程时细说 """
 
def index(self, sub, start=None, end=None): """ 子序列位置,如果没找到,报错 """
 
def isalnum(self): """ 是否是字母和数字 """
def isalpha(self): """ 是否是字母 """
def isdigit(self): """ 是否是数字 """
def islower(self): """ 是否小写 """
def isspace(self): ""是否有空格"
def istitle(self): ""是否为标题"
 
def isupper(self): ""是否都是大写" S.isupper() -> bool
def join(self, iterable): """ 连接 """ """ S.join(iterable) -> string
 
 
def ljust(self, width, fillchar=None): """ 内容左对齐,右侧填充 """ """ S.ljust(width[, fillchar]) -> string
 
def lower(self): """ 变小写 """ """ S.lower() -> string
 
def lstrip(self, chars=None): """ 移除左侧空白 """ """ S.lstrip([chars]) -> string or unicode
 
 
def partition(self, sep): """ 分割,前,中,后三部分 """ """ S.partition(sep) -> (head, sep, tail)
 
def replace(self, old, new, count=None): """ 替换 """ """ S.replace(old, new[, count]) -> string
 
def rsplit(self, sep=None, maxsplit=None): ""按字母分割" S.rsplit([sep [,maxsplit]]) -> list of strings
 
 
def splitlines(self, keepends=False): """ 根据换行分割 """ """ S.splitlines(keepends=False) -> list of strings
def startswith(self, prefix, start=None, end=None): """ 是否起始 """ """ S.startswith(prefix[, start[, end]]) -> bool
def swapcase(self): """ 大写变小写,小写变大写 """ """ S.swapcase() -> string
 
def title(self): ""变成标题" S.title() -> string
 

转载于:https://www.cnblogs.com/huangsuo/p/9188270.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值