一.变量

  1. 1 什么是变量之声明变量
  1. #变量名=变量值
  2. age=18
  3. gender1='male'
  4. gender2='female'
  1. 2 为什么要有变量
  2.  
  3. 变量作用:“变”=>变化,“量”=>计量/保存状态
    程序的运行本质是一系列状态的变化,变量的目的就是用来保存状态,变量值的变化就构成了程序运行的不同结果。
    例如:CS枪战,一个人的生命可以表示为lifeactive表示存活,当满足某种条件后修改变量lifeinactive表示死亡。
    3 变量值之类型与对象
    程序中需要处理的状态很多,于是有了不同类型的变量值,x='egon',变量值'egon'存放与内存中,绑定一个名字x变量值即我们要存储的数据
  4.  
  5. python中所有数据都是围绕对象这个概念来构建的,对象包含一些基本的数据类型:数字,字符串,列表,元组,字典等
    程序中存储的所有数据都是对象,
    一个对象(如a=1)有:
      一个身份(id
      一个类型(type)
      一个值(通过变量名a来查看)
    1 对象的类型也称为对象的类别,python为每个类型都定制了属于该类型特有的方法,极大地方便了开发者对数据的处理
    2 创建某个特定类型的对象也称为创建了该类型的一个实例工厂函数的概念来源于此
    4 可变对象与不可变对象
    实例被创建后,身份和类型是不可变的,
    如果值是不可以被修改的,则是不可变对象
    如果值是可以被修改的,则是可变对象
  6.  
  7. 5 容器对象
    某个对象包含对其他对象的引用,则称为容器或集合
  8.  
  9. 6 对象的属性和方法
    属性就是对象的值,方法就是调用时将在对象本身上执行某些操作的函数,使用.运算符可以访问对象的属性和方法,如
    a=3+4j
    a.real
  10.  
  11. b=[1,2,3]
    b.append(4)
  12.  
  13. 7 身份比较,类型比较,值比较
    x=1
    y=1
    x is y #x与y是同一个对象,is比较的是id,即身份
    type(x) is type(y) #对象的类型本身也是一个对象,所以可以用is比较两个对象的类型的身份
    x == y #==比较的是两个对象的值是否相等
  14.  
  15. 7 变量的命名规范
  • 变量命名规则遵循标识符命名规则,详见第二篇

  8 变量的赋值操作

  • 与c语言的区别在于变量赋值操作无返回值
  • 链式赋值:y=x=a=1
  • 多元赋值:x,y=1,2 x,y=y,x
  • 增量赋值:x+=1

二.数据类型

2.1 什么是数据类型及数据类型分类

  1. 程序的本质就是驱使计算机去处理各种状态的变化,这些状态分为很多种
  2.  
  3. 例如英雄联盟游戏,一个人物角色有名字,钱,等级,装备等特性,大家第一时间会想到这么表示
    名字:德玛西亚------------>字符串
    钱:10000 ------------>数字
    等级:15 ------------>数字
    装备:鞋子,日炎斗篷,兰顿之兆---->列表
    (记录这些人物特性的是变量,这些特性的真实存在则是变量的值,存不同的特性需要用不同类型的值)
  4.  
  5. python中的数据类型
    python使用对象模型来存储数据,每一个数据类型都有一个内置的类,每新建一个数据,实际就是在初始化生成一个对象,即所有数据都是对象
    对象三个特性
  • 身份:内存地址,可以用id()获取
  • 类型:决定了该对象可以保存什么类型值,可执行何种操作,需遵循什么规则,可用type()获取
  • 值:对象保存的真实数据
  1. 注:我们在定义数据类型,只需这样:x1,内部生成1这一内存对象会自动触发,我们无需关心
  2.  
  3. 这里的字符串、数字、列表等都是数据类型(用来描述某种状态或者特性)除此之外还有很多其他数据,处理不同的数据就需要定义不同的数据类型
标准类型  其他类型
数字 类型type
字符串 Null
列表 文件
元组 集合
字典 函数/方法
 
  模块
  1.  

2.2 标准数据类型:

2.2.1 数字

定义:a=1

特性:

1.只能存放一个值

2.一经定义,不可更改

3.直接访问

分类:整型,长整型,布尔,浮点,复数

2.2.1.1 整型:

Python的整型相当于C中的long型,Python中的整数可以用十进制,八进制,十六进制表示。

  1. >>> 10
  2. 10 --------->默认十进制
  3. >>> oct(10)
  4. '012' --------->八进制表示整数时,数值前面要加上一个前缀“0
  5. >>> hex(10)
  6. '0xa' --------->十六进制表示整数时,数字前面要加上前缀0X0x

python2.*与python3.*关于整型的区别

  1. python2.*
    32位机器上,整数的位数为32位,取值范围为-2**312**31-1,即-21474836482147483647
  2.  
  3. 64位系统上,整数的位数为64位,取值范围为-2**632**63-1,即-92233720368547758089223372036854775807
    python3.*整形长度无限制

整型工厂函数int()

  1. class int(object):
  2. """
  3. int(x=) -> int or long
  4. int(x, base=) -> int or long
  5.  
  6. Convert a number or string to an integer, or return if no arguments
  7. are given. If x is floating point, the conversion truncates towards zero.
  8. If x is outside the integer range, the function returns a long instead.
  9.  
  10. If x is not a number or if base is given, then x must be a string or
  11. Unicode object representing an integer literal in the given base. The
  12. literal can be preceded by '+' or '-' and be surrounded by whitespace.
  13. The base defaults to . Valid bases are and -. Base means to
  14. interpret the base from the string as an integer literal.
  15. >>> int('0b100', base=)
  16. """
  17. def bit_length(self):
  18. """ 返回表示该数字的时占用的最少位数 """
  19. """
  20. int.bit_length() -> int
  21.  
  22. Number of bits necessary to represent self in binary.
  23. >>> bin()
  24. '0b100101'
  25. >>> ().bit_length()
  26. """
  27. return
  28.  
  29. def conjugate(self, *args, **kwargs): # real signature unknown
  30. """ 返回该复数的共轭复数 """
  31. """ Returns self, the complex conjugate of any int. """
  32. pass
  33.  
  34. def __abs__(self):
  35. """ 返回绝对值 """
  36. """ x.__abs__() <==> abs(x) """
  37. pass
  38.  
  39. def __add__(self, y):
  40. """ x.__add__(y) <==> x+y """
  41. pass
  42.  
  43. def __and__(self, y):
  44. """ x.__and__(y) <==> x&y """
  45. pass
  46.  
  47. def __cmp__(self, y):
  48. """ 比较两个数大小 """
  49. """ x.__cmp__(y) <==> cmp(x,y) """
  50. pass
  51.  
  52. def __coerce__(self, y):
  53. """ 强制生成一个元组 """
  54. """ x.__coerce__(y) <==> coerce(x, y) """
  55. pass
  56.  
  57. def __divmod__(self, y):
  58. """ 相除,得到商和余数组成的元组 """
  59. """ x.__divmod__(y) <==> divmod(x, y) """
  60. pass
  61.  
  62. def __div__(self, y):
  63. """ x.__div__(y) <==> x/y """
  64. pass
  65.  
  66. def __float__(self):
  67. """ 转换为浮点类型 """
  68. """ x.__float__() <==> float(x) """
  69. pass
  70.  
  71. def __floordiv__(self, y):
  72. """ x.__floordiv__(y) <==> x//y """
  73. pass
  74.  
  75. def __format__(self, *args, **kwargs): # real signature unknown
  76. pass
  77.  
  78. def __getattribute__(self, name):
  79. """ x.__getattribute__('name') <==> x.name """
  80. pass
  81.  
  82. def __getnewargs__(self, *args, **kwargs): # real signature unknown
  83. """ 内部调用 __new__方法或创建对象时传入参数使用 """
  84. pass
  85.  
  86. def __hash__(self):
  87. """如果对象object为哈希表类型,返回对象object的哈希值。哈希值为整数。在字典查找中,哈希值用于快速比较字典的键。两个数值如果相等,则哈希值也相等。"""
  88. """ x.__hash__() <==> hash(x) """
  89. pass
  90.  
  91. def __hex__(self):
  92. """ 返回当前数的 十六进制 表示 """
  93. """ x.__hex__() <==> hex(x) """
  94. pass
  95.  
  96. def __index__(self):
  97. """ 用于切片,数字无意义 """
  98. """ x[y:z] <==> x[y.__index__():z.__index__()] """
  99. pass
  100.  
  101. def __init__(self, x, base=): # known special case of int.__init__
  102. """ 构造方法,执行 x = 123 或 x = int(10) 时,自动调用,暂时忽略 """
  103. """
  104. int(x=) -> int or long
  105. int(x, base=) -> int or long
  106.  
  107. Convert a number or string to an integer, or return if no arguments
  108. are given. If x is floating point, the conversion truncates towards zero.
  109. If x is outside the integer range, the function returns a long instead.
  110.  
  111. If x is not a number or if base is given, then x must be a string or
  112. Unicode object representing an integer literal in the given base. The
  113. literal can be preceded by '+' or '-' and be surrounded by whitespace.
  114. The base defaults to . Valid bases are and -. Base means to
  115. interpret the base from the string as an integer literal.
  116. >>> int('0b100', base=)
  117. # (copied from class doc)
  118. """
  119. pass
  120.  
  121. def __int__(self):
  122. """ 转换为整数 """
  123. """ x.__int__() <==> int(x) """
  124. pass
  125.  
  126. def __invert__(self):
  127. """ x.__invert__() <==> ~x """
  128. pass
  129.  
  130. def __long__(self):
  131. """ 转换为长整数 """
  132. """ x.__long__() <==> long(x) """
  133. pass
  134.  
  135. def __lshift__(self, y):
  136. """ x.__lshift__(y) <==> x<<y """
  137. pass
  138.  
  139. def __mod__(self, y):
  140. """ x.__mod__(y) <==> x%y """
  141. pass
  142.  
  143. def __mul__(self, y):
  144. """ x.__mul__(y) <==> x*y """
  145. pass
  146.  
  147. def __neg__(self):
  148. """ x.__neg__() <==> -x """
  149. pass
  150.  
  151. @staticmethod # known case of __new__
  152. def __new__(S, *more):
  153. """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
  154. pass
  155.  
  156. def __nonzero__(self):
  157. """ x.__nonzero__() <==> x != 0 """
  158. pass
  159.  
  160. def __oct__(self):
  161. """ 返回改值的 八进制 表示 """
  162. """ x.__oct__() <==> oct(x) """
  163. pass
  164.  
  165. def __or__(self, y):
  166. """ x.__or__(y) <==> x|y """
  167. pass
  168.  
  169. def __pos__(self):
  170. """ x.__pos__() <==> +x """
  171. pass
  172.  
  173. def __pow__(self, y, z=None):
  174. """ 幂,次方 """
  175. """ x.__pow__(y[, z]) <==> pow(x, y[, z]) """
  176. pass
  177.  
  178. def __radd__(self, y):
  179. """ x.__radd__(y) <==> y+x """
  180. pass
  181.  
  182. def __rand__(self, y):
  183. """ x.__rand__(y) <==> y&x """
  184. pass
  185.  
  186. def __rdivmod__(self, y):
  187. """ x.__rdivmod__(y) <==> divmod(y, x) """
  188. pass
  189.  
  190. def __rdiv__(self, y):
  191. """ x.__rdiv__(y) <==> y/x """
  192. pass
  193.  
  194. def __repr__(self):
  195. """转化为解释器可读取的形式 """
  196. """ x.__repr__() <==> repr(x) """
  197. pass
  198.  
  199. def __str__(self):
  200. """转换为人阅读的形式,如果没有适于人阅读的解释形式的话,则返回解释器课阅读的形式"""
  201. """ x.__str__() <==> str(x) """
  202. pass
  203.  
  204. def __rfloordiv__(self, y):
  205. """ x.__rfloordiv__(y) <==> y//x """
  206. pass
  207.  
  208. def __rlshift__(self, y):
  209. """ x.__rlshift__(y) <==> y<<x """
  210. pass
  211.  
  212. def __rmod__(self, y):
  213. """ x.__rmod__(y) <==> y%x """
  214. pass
  215.  
  216. def __rmul__(self, y):
  217. """ x.__rmul__(y) <==> y*x """
  218. pass
  219.  
  220. def __ror__(self, y):
  221. """ x.__ror__(y) <==> y|x """
  222. pass
  223.  
  224. def __rpow__(self, x, z=None):
  225. """ y.__rpow__(x[, z]) <==> pow(x, y[, z]) """
  226. pass
  227.  
  228. def __rrshift__(self, y):
  229. """ x.__rrshift__(y) <==> y>>x """
  230. pass
  231.  
  232. def __rshift__(self, y):
  233. """ x.__rshift__(y) <==> x>>y """
  234. pass
  235.  
  236. def __rsub__(self, y):
  237. """ x.__rsub__(y) <==> y-x """
  238. pass
  239.  
  240. def __rtruediv__(self, y):
  241. """ x.__rtruediv__(y) <==> y/x """
  242. pass
  243.  
  244. def __rxor__(self, y):
  245. """ x.__rxor__(y) <==> y^x """
  246. pass
  247.  
  248. def __sub__(self, y):
  249. """ x.__sub__(y) <==> x-y """
  250. pass
  251.  
  252. def __truediv__(self, y):
  253. """ x.__truediv__(y) <==> x/y """
  254. pass
  255.  
  256. def __trunc__(self, *args, **kwargs):
  257. """ 返回数值被截取为整形的值,在整形中无意义 """
  258. pass
  259.  
  260. def __xor__(self, y):
  261. """ x.__xor__(y) <==> x^y """
  262. pass
  263.  
  264. denominator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  265. """ 分母 = 1 """
  266. """the denominator of a rational number in lowest terms"""
  267.  
  268. imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  269. """ 虚数,无意义 """
  270. """the imaginary part of a complex number"""
  271.  
  272. numerator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  273. """ 分子 = 数字大小 """
  274. """the numerator of a rational number in lowest terms"""
  275.  
  276. real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  277. """ 实属,无意义 """
  278. """the real part of a complex number"""
  279.  
  280. int
  281.  
  282. python2.

python2.7

  1. class int(object):
  2. """
  3. int(x=) -> integer
  4. int(x, base=) -> integer
  5.  
  6. Convert a number or string to an integer, or return if no arguments
  7. are given. If x is a number, return x.__int__(). For floating point
  8. numbers, this truncates towards zero.
  9.  
  10. If x is not a number or if base is given, then x must be a string,
  11. bytes, or bytearray instance representing an integer literal in the
  12. given base. The literal can be preceded by '+' or '-' and be surrounded
  13. by whitespace. The base defaults to . Valid bases are and -.
  14. Base means to interpret the base from the string as an integer literal.
  15. >>> int('0b100', base=)
  16. """
  17. def bit_length(self): # real signature unknown; restored from __doc__
  18. """ 返回表示该数字的时占用的最少位数 """
  19. """
  20. int.bit_length() -> int
  21.  
  22. Number of bits necessary to represent self in binary.
  23. >>> bin()
  24. '0b100101'
  25. >>> ().bit_length()
  26. """
  27. return
  28.  
  29. def conjugate(self, *args, **kwargs): # real signature unknown
  30. """ 返回该复数的共轭复数 """
  31. """ Returns self, the complex conjugate of any int. """
  32. pass
  33.  
  34. @classmethod # known case
  35. def from_bytes(cls, bytes, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
  36. """
  37. int.from_bytes(bytes, byteorder, *, signed=False) -> int
  38.  
  39. Return the integer represented by the given array of bytes.
  40.  
  41. The bytes argument must be a bytes-like object (e.g. bytes or bytearray).
  42.  
  43. The byteorder argument determines the byte order used to represent the
  44. integer. If byteorder is 'big', the most significant byte is at the
  45. beginning of the byte array. If byteorder is 'little', the most
  46. significant byte is at the end of the byte array. To request the native
  47. byte order of the host system, use `sys.byteorder' as the byte order value.
  48.  
  49. The signed keyword-only argument indicates whether two's complement is
  50. used to represent the integer.
  51. """
  52. pass
  53.  
  54. def to_bytes(self, length, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
  55. """
  56. int.to_bytes(length, byteorder, *, signed=False) -> bytes
  57.  
  58. Return an array of bytes representing an integer.
  59.  
  60. The integer is represented using length bytes. An OverflowError is
  61. raised if the integer is not representable with the given number of
  62. bytes.
  63.  
  64. The byteorder argument determines the byte order used to represent the
  65. integer. If byteorder is 'big', the most significant byte is at the
  66. beginning of the byte array. If byteorder is 'little', the most
  67. significant byte is at the end of the byte array. To request the native
  68. byte order of the host system, use `sys.byteorder' as the byte order value.
  69.  
  70. The signed keyword-only argument determines whether two's complement is
  71. used to represent the integer. If signed is False and a negative integer
  72. is given, an OverflowError is raised.
  73. """
  74. pass
  75.  
  76. def __abs__(self, *args, **kwargs): # real signature unknown
  77. """ abs(self) """
  78. pass
  79.  
  80. def __add__(self, *args, **kwargs): # real signature unknown
  81. """ Return self+value. """
  82. pass
  83.  
  84. def __and__(self, *args, **kwargs): # real signature unknown
  85. """ Return self&value. """
  86. pass
  87.  
  88. def __bool__(self, *args, **kwargs): # real signature unknown
  89. """ self != 0 """
  90. pass
  91.  
  92. def __ceil__(self, *args, **kwargs): # real signature unknown
  93. """
  94. 整数返回自己
  95. 如果是小数
  96. math.ceil(3.1)返回4
  97. """
  98. """ Ceiling of an Integral returns itself. """
  99. pass
  100.  
  101. def __divmod__(self, *args, **kwargs): # real signature unknown
  102. """ 相除,得到商和余数组成的元组 """
  103. """ Return divmod(self, value). """
  104. pass
  105.  
  106. def __eq__(self, *args, **kwargs): # real signature unknown
  107. """ Return self==value. """
  108. pass
  109.  
  110. def __float__(self, *args, **kwargs): # real signature unknown
  111. """ float(self) """
  112. pass
  113.  
  114. def __floordiv__(self, *args, **kwargs): # real signature unknown
  115. """ Return self//value. """
  116. pass
  117.  
  118. def __floor__(self, *args, **kwargs): # real signature unknown
  119. """ Flooring an Integral returns itself. """
  120. pass
  121.  
  122. def __format__(self, *args, **kwargs): # real signature unknown
  123. pass
  124.  
  125. def __getattribute__(self, *args, **kwargs): # real signature unknown
  126. """ Return getattr(self, name). """
  127. pass
  128.  
  129. def __getnewargs__(self, *args, **kwargs): # real signature unknown
  130. pass
  131.  
  132. def __ge__(self, *args, **kwargs): # real signature unknown
  133. """ Return self>=value. """
  134. pass
  135.  
  136. def __gt__(self, *args, **kwargs): # real signature unknown
  137. """ Return self>value. """
  138. pass
  139.  
  140. def __hash__(self, *args, **kwargs): # real signature unknown
  141. """ Return hash(self). """
  142. pass
  143.  
  144. def __index__(self, *args, **kwargs): # real signature unknown
  145. """ 用于切片,数字无意义 """
  146. """ Return self converted to an integer, if self is suitable for use as an index into a list. """
  147. pass
  148.  
  149. def __init__(self, x, base=): # known special case of int.__init__
  150. """ 构造方法,执行 x = 123 或 x = int(10) 时,自动调用,暂时忽略 """
  151. """
  152. int(x=) -> integer
  153. int(x, base=) -> integer
  154.  
  155. Convert a number or string to an integer, or return if no arguments
  156. are given. If x is a number, return x.__int__(). For floating point
  157. numbers, this truncates towards zero.
  158.  
  159. If x is not a number or if base is given, then x must be a string,
  160. bytes, or bytearray instance representing an integer literal in the
  161. given base. The literal can be preceded by '+' or '-' and be surrounded
  162. by whitespace. The base defaults to . Valid bases are and -.
  163. Base means to interpret the base from the string as an integer literal.
  164. >>> int('0b100', base=)
  165. # (copied from class doc)
  166. """
  167. pass
  168.  
  169. def __int__(self, *args, **kwargs): # real signature unknown
  170.  
  171. """ int(self) """
  172. pass
  173.  
  174. def __invert__(self, *args, **kwargs): # real signature unknown
  175. """ ~self """
  176. pass
  177.  
  178. def __le__(self, *args, **kwargs): # real signature unknown
  179. """ Return self<=value. """
  180. pass
  181.  
  182. def __lshift__(self, *args, **kwargs): # real signature unknown
  183. """ Return self<<value. """
  184. pass
  185.  
  186. def __lt__(self, *args, **kwargs): # real signature unknown
  187. """ Return self<value. """
  188. pass
  189.  
  190. def __mod__(self, *args, **kwargs): # real signature unknown
  191. """ Return self%value. """
  192. pass
  193.  
  194. def __mul__(self, *args, **kwargs): # real signature unknown
  195. """ Return self*value. """
  196. pass
  197.  
  198. def __neg__(self, *args, **kwargs): # real signature unknown
  199. """ -self """
  200. pass
  201.  
  202. @staticmethod # known case of __new__
  203. def __new__(*args, **kwargs): # real signature unknown
  204. """ Create and return a new object. See help(type) for accurate signature. """
  205. pass
  206.  
  207. def __ne__(self, *args, **kwargs): # real signature unknown
  208. """ Return self!=value. """
  209. pass
  210.  
  211. def __or__(self, *args, **kwargs): # real signature unknown
  212. """ Return self|value. """
  213. pass
  214.  
  215. def __pos__(self, *args, **kwargs): # real signature unknown
  216. """ +self """
  217. pass
  218.  
  219. def __pow__(self, *args, **kwargs): # real signature unknown
  220. """ Return pow(self, value, mod). """
  221. pass
  222.  
  223. def __radd__(self, *args, **kwargs): # real signature unknown
  224. """ Return value+self. """
  225. pass
  226.  
  227. def __rand__(self, *args, **kwargs): # real signature unknown
  228. """ Return value&self. """
  229. pass
  230.  
  231. def __rdivmod__(self, *args, **kwargs): # real signature unknown
  232. """ Return divmod(value, self). """
  233. pass
  234.  
  235. def __repr__(self, *args, **kwargs): # real signature unknown
  236. """ Return repr(self). """
  237. pass
  238.  
  239. def __rfloordiv__(self, *args, **kwargs): # real signature unknown
  240. """ Return value//self. """
  241. pass
  242.  
  243. def __rlshift__(self, *args, **kwargs): # real signature unknown
  244. """ Return value<<self. """
  245. pass
  246.  
  247. def __rmod__(self, *args, **kwargs): # real signature unknown
  248. """ Return value%self. """
  249. pass
  250.  
  251. def __rmul__(self, *args, **kwargs): # real signature unknown
  252. """ Return value*self. """
  253. pass
  254.  
  255. def __ror__(self, *args, **kwargs): # real signature unknown
  256. """ Return value|self. """
  257. pass
  258.  
  259. def __round__(self, *args, **kwargs): # real signature unknown
  260. """
  261. Rounding an Integral returns itself.
  262. Rounding with an ndigits argument also returns an integer.
  263. """
  264. pass
  265.  
  266. def __rpow__(self, *args, **kwargs): # real signature unknown
  267. """ Return pow(value, self, mod). """
  268. pass
  269.  
  270. def __rrshift__(self, *args, **kwargs): # real signature unknown
  271. """ Return value>>self. """
  272. pass
  273.  
  274. def __rshift__(self, *args, **kwargs): # real signature unknown
  275. """ Return self>>value. """
  276. pass
  277.  
  278. def __rsub__(self, *args, **kwargs): # real signature unknown
  279. """ Return value-self. """
  280. pass
  281.  
  282. def __rtruediv__(self, *args, **kwargs): # real signature unknown
  283. """ Return value/self. """
  284. pass
  285.  
  286. def __rxor__(self, *args, **kwargs): # real signature unknown
  287. """ Return value^self. """
  288. pass
  289.  
  290. def __sizeof__(self, *args, **kwargs): # real signature unknown
  291. """ Returns size in memory, in bytes """
  292. pass
  293.  
  294. def __str__(self, *args, **kwargs): # real signature unknown
  295. """ Return str(self). """
  296. pass
  297.  
  298. def __sub__(self, *args, **kwargs): # real signature unknown
  299. """ Return self-value. """
  300. pass
  301.  
  302. def __truediv__(self, *args, **kwargs): # real signature unknown
  303. """ Return self/value. """
  304. pass
  305.  
  306. def __trunc__(self, *args, **kwargs): # real signature unknown
  307. """ Truncating an Integral returns itself. """
  308. pass
  309.  
  310. def __xor__(self, *args, **kwargs): # real signature unknown
  311. """ Return self^value. """
  312. pass
  313.  
  314. denominator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  315. """the denominator of a rational number in lowest terms"""
  316.  
  317. imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  318. """the imaginary part of a complex number"""
  319.  
  320. numerator = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  321. """the numerator of a rational number in lowest terms"""
  322.  
  323. real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
  324. """the real part of a complex number"""
  325.  
  326. python3.

python3.5

2.2.1.2 长整型long:

  1. python2.*:
    C语言不同,Python的长整型没有指定位宽,也就是说Python没有限制长整型数值的大小,
    但是实际上由于机器内存有限,所以我们使用的长整型数值不可能无限大。
    在使用过程中,我们如何区分长整型和整型数值呢?
    通常的做法是在数字尾部加上一个大写字母L或小写字母l以表示该整数是长整型的,例如:
    a = 9223372036854775808L
    注意,自从Python2起,如果发生溢出,Python会自动将整型数据转换为长整型,
    所以如今在长整型数据后面不加字母L也不会导致严重后果了。
  2.  
  3. python3.*
    长整型,整型统一归为整型
  1. python2.
  2. >>> a=
  3. >>> a
  4. >>> a+=
  5. >>> a
  6. 9223372036854775808L
  7.  
  8. python3.
  9. >>> a=
  10. >>> a
  11. >>> a+=
  12. >>> a
  13.  
  14. 查看

查看

2.2.1.3 布尔bool:

  1. True False
    10

2.2.1.4 浮点数float:

  1. Python的浮点数就是数学中的小数,类似C语言中的double
    在运算中,整数与浮点数运算的结果是浮点数
    浮点数也就是小数,之所以称为浮点数,是因为按照科学记数法表示时,
    一个浮点数的小数点位置是可变的,比如,1.23*10912.3*108是相等的。
    浮点数可以用数学写法,如1.233.14,-9.01,等等。但是对于很大或很小的浮点数,
    就必须用科学计数法表示,把10e替代,1.23*109就是1.23e9,或者12.3e80.000012
    可以写成1.2e-5,等等。
    整数和浮点数在计算机内部存储的方式是不同的,整数运算永远是精确的而浮点数运算则可能会有
    四舍五入的误差。

2.2.1.5 复数complex:

  1. 复数由实数部分和虚数部分组成,一般形式为xyj,其中的x是复数的实数部分,y是复数的虚数部分,这里的xy都是实数。
    注意,虚数部分的字母j大小写都可以,
  1. >>> 1.3 + 2.5j == 1.3 + 2.5J
  2. True

2.2.1.6 数字相关内建函数

2.2.2 字符串

  1. 定义:它是一个有序的字符的集合,用于存储和表示基本的文本信息,‘’或“”或‘’‘ ’‘’中间包含的内容称之为字符串
    特性:
    1.只能存放一个值
    2.不可变
    3.按照从左到右的顺序定义字符集合,下标从0开始顺序访问,有序
    补充:
      1.字符串的单引号和双引号都无法取消特殊字符的含义,如果想让引号内所有字符均取消特殊意义,在引号前面加r,如namer'l\thf'
      2.unicode字符串与r连用必需在r前面,如nameur'l\thf'

2.2.2.1 字符串创建

‘hello world’

2.2.2.2 字符串常用操作

  1. 移除空白
    分割
    长度
    索引
    切片

2.2.2.3 字符工厂函数str()

  1. class str(object):
  2. """
  3. str(object='') -> str
  4. str(bytes_or_buffer[, encoding[, errors]]) -> str
  5.  
  6. Create a new string object from the given object. If encoding or
  7. errors is specified, then the object must expose a data buffer
  8. that will be decoded using the given encoding and error handler.
  9. Otherwise, returns the result of object.__str__() (if defined)
  10. or repr(object).
  11. encoding defaults to sys.getdefaultencoding().
  12. errors defaults to 'strict'.
  13. """
  14. def capitalize(self): # real signature unknown; restored from __doc__
  15. """
  16. 首字母变大写
  17. S.capitalize() -> str
  18.  
  19. Return a capitalized version of S, i.e. make the first character
  20. have upper case and the rest lower case.
  21. """
  22. return ""
  23.  
  24. def casefold(self): # real signature unknown; restored from __doc__
  25. """
  26. S.casefold() -> str
  27.  
  28. Return a version of S suitable for caseless comparisons.
  29. """
  30. return ""
  31.  
  32. def center(self, width, fillchar=None): # real signature unknown; restored from __doc__
  33. """
  34. 原来字符居中,不够用空格补全
  35. S.center(width[, fillchar]) -> str
  36.  
  37. Return S centered in a string of length width. Padding is
  38. done using the specified fill character (default is a space)
  39. """
  40. return ""
  41.  
  42. def count(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
  43. """
  44. 从一个范围内的统计某str出现次数
  45. S.count(sub[, start[, end]]) -> int
  46.  
  47. Return the number of non-overlapping occurrences of substring sub in
  48. string S[start:end]. Optional arguments start and end are
  49. interpreted as in slice notation.
  50. """
  51. return
  52.  
  53. def encode(self, encoding='utf-8', errors='strict'): # real signature unknown; restored from __doc__
  54. """
  55. encode(encoding='utf-8',errors='strict')
  56. 以encoding指定编码格式编码,如果出错默认报一个ValueError,除非errors指定的是
  57. ignore或replace
  58.  
  59. S.encode(encoding='utf-8', errors='strict') -> bytes
  60.  
  61. Encode S using the codec registered for encoding. Default encoding
  62. is 'utf-8'. errors may be given to set a different error
  63. handling scheme. Default is 'strict' meaning that encoding errors raise
  64. a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
  65. 'xmlcharrefreplace' as well as any other name registered with
  66. codecs.register_error that can handle UnicodeEncodeErrors.
  67. """
  68. return b""
  69.  
  70. def endswith(self, suffix, start=None, end=None): # real signature unknown; restored from __doc__
  71. """
  72. S.endswith(suffix[, start[, end]]) -> bool
  73.  
  74. Return True if S ends with the specified suffix, False otherwise.
  75. With optional start, test S beginning at that position.
  76. With optional end, stop comparing S at that position.
  77. suffix can also be a tuple of strings to try.
  78. """
  79. return False
  80.  
  81. def expandtabs(self, tabsize=): # real signature unknown; restored from __doc__
  82. """
  83. 将字符串中包含的\t转换成tabsize个空格
  84. S.expandtabs(tabsize=) -> str
  85.  
  86. Return a copy of S where all tab characters are expanded using spaces.
  87. If tabsize is not given, a tab size of characters is assumed.
  88. """
  89. return ""
  90.  
  91. def find(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
  92. """
  93. S.find(sub[, start[, end]]) -> int
  94.  
  95. Return the lowest index in S where substring sub is found,
  96. such that sub is contained within S[start:end]. Optional
  97. arguments start and end are interpreted as in slice notation.
  98.  
  99. Return - on failure.
  100. """
  101. return
  102.  
  103. def format(self, *args, **kwargs): # known special case of str.format
  104. """
  105. 格式化输出
  106. 三种形式:
  107. 形式一.
  108. >>> print('{0}{1}{0}'.format('a','b'))
  109. aba
  110.  
  111. 形式二:(必须一一对应)
  112. >>> print('{}{}{}'.format('a','b'))
  113. Traceback (most recent call last):
  114. File "<input>", line , in <module>
  115. IndexError: tuple index out of range
  116. >>> print('{}{}'.format('a','b'))
  117. ab
  118.  
  119. 形式三:
  120. >>> print('{name} {age}'.format(age=,name='lhf'))
  121. lhf
  122.  
  123. S.format(*args, **kwargs) -> str
  124.  
  125. Return a formatted version of S, using substitutions from args and kwargs.
  126. The substitutions are identified by braces ('{' and '}').
  127. """
  128. pass
  129.  
  130. def format_map(self, mapping): # real signature unknown; restored from __doc__
  131. """
  132. 与format区别
  133. '{name}'.format(**dict(name='alex'))
  134. '{name}'.format_map(dict(name='alex'))
  135.  
  136. S.format_map(mapping) -> str
  137.  
  138. Return a formatted version of S, using substitutions from mapping.
  139. The substitutions are identified by braces ('{' and '}').
  140. """
  141. return ""
  142.  
  143. def index(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
  144. """
  145. S.index(sub[, start[, end]]) -> int
  146.  
  147. Like S.find() but raise ValueError when the substring is not found.
  148. """
  149. return
  150.  
  151. def isalnum(self): # real signature unknown; restored from __doc__
  152. """
  153. 至少一个字符,且都是字母或数字才返回True
  154.  
  155. S.isalnum() -> bool
  156.  
  157. Return True if all characters in S are alphanumeric
  158. and there is at least one character in S, False otherwise.
  159. """
  160. return False
  161.  
  162. def isalpha(self): # real signature unknown; restored from __doc__
  163. """
  164. 至少一个字符,且都是字母才返回True
  165. S.isalpha() -> bool
  166.  
  167. Return True if all characters in S are alphabetic
  168. and there is at least one character in S, False otherwise.
  169. """
  170. return False
  171.  
  172. def isdecimal(self): # real signature unknown; restored from __doc__
  173. """
  174. S.isdecimal() -> bool
  175.  
  176. Return True if there are only decimal characters in S,
  177. False otherwise.
  178. """
  179. return False
  180.  
  181. def isdigit(self): # real signature unknown; restored from __doc__
  182. """
  183. S.isdigit() -> bool
  184.  
  185. Return True if all characters in S are digits
  186. and there is at least one character in S, False otherwise.
  187. """
  188. return False
  189.  
  190. def isidentifier(self): # real signature unknown; restored from __doc__
  191. """
  192. 字符串为关键字返回True
  193.  
  194. S.isidentifier() -> bool
  195.  
  196. Return True if S is a valid identifier according
  197. to the language definition.
  198.  
  199. Use keyword.iskeyword() to test for reserved identifiers
  200. such as "def" and "class".
  201. """
  202. return False
  203.  
  204. def islower(self): # real signature unknown; restored from __doc__
  205. """
  206. 至少一个字符,且都是小写字母才返回True
  207. S.islower() -> bool
  208.  
  209. Return True if all cased characters in S are lowercase and there is
  210. at least one cased character in S, False otherwise.
  211. """
  212. return False
  213.  
  214. def isnumeric(self): # real signature unknown; restored from __doc__
  215. """
  216. S.isnumeric() -> bool
  217.  
  218. Return True if there are only numeric characters in S,
  219. False otherwise.
  220. """
  221. return False
  222.  
  223. def isprintable(self): # real signature unknown; restored from __doc__
  224. """
  225. S.isprintable() -> bool
  226.  
  227. Return True if all characters in S are considered
  228. printable in repr() or S is empty, False otherwise.
  229. """
  230. return False
  231.  
  232. def isspace(self): # real signature unknown; restored from __doc__
  233. """
  234. 至少一个字符,且都是空格才返回True
  235. S.isspace() -> bool
  236.  
  237. Return True if all characters in S are whitespace
  238. and there is at least one character in S, False otherwise.
  239. """
  240. return False
  241.  
  242. def istitle(self): # real signature unknown; restored from __doc__
  243. """
  244. >>> a='Hello'
  245. >>> a.istitle()
  246. True
  247. >>> a='HellP'
  248. >>> a.istitle()
  249. False
  250.  
  251. S.istitle() -> bool
  252.  
  253. Return True if S is a titlecased string and there is at least one
  254. character in S, i.e. upper- and titlecase characters may only
  255. follow uncased characters and lowercase characters only cased ones.
  256. Return False otherwise.
  257. """
  258. return False
  259.  
  260. def isupper(self): # real signature unknown; restored from __doc__
  261. """
  262. S.isupper() -> bool
  263.  
  264. Return True if all cased characters in S are uppercase and there is
  265. at least one cased character in S, False otherwise.
  266. """
  267. return False
  268.  
  269. def join(self, iterable): # real signature unknown; restored from __doc__
  270. """
  271. #对序列进行操作(分别使用' '与':'作为分隔符)
  272. >>> seq1 = ['hello','good','boy','doiido']
  273. >>> print ' '.join(seq1)
  274. hello good boy doiido
  275. >>> print ':'.join(seq1)
  276. hello:good:boy:doiido
  277.  
  278. #对字符串进行操作
  279.  
  280. >>> seq2 = "hello good boy doiido"
  281. >>> print ':'.join(seq2)
  282. h:e:l:l:o: :g:o:o:d: :b:o:y: :d:o:i:i:d:o
  283.  
  284. #对元组进行操作
  285.  
  286. >>> seq3 = ('hello','good','boy','doiido')
  287. >>> print ':'.join(seq3)
  288. hello:good:boy:doiido
  289.  
  290. #对字典进行操作
  291.  
  292. >>> seq4 = {'hello':,'good':,'boy':,'doiido':}
  293. >>> print ':'.join(seq4)
  294. boy:good:doiido:hello
  295.  
  296. #合并目录
  297.  
  298. >>> import os
  299. >>> os.path.join('/hello/','good/boy/','doiido')
  300. '/hello/good/boy/doiido'
  301.  
  302. S.join(iterable) -> str
  303.  
  304. Return a string which is the concatenation of the strings in the
  305. iterable. The separator between elements is S.
  306. """
  307. return ""
  308.  
  309. def ljust(self, width, fillchar=None): # real signature unknown; restored from __doc__
  310. """
  311. S.ljust(width[, fillchar]) -> str
  312.  
  313. Return S left-justified in a Unicode string of length width. Padding is
  314. done using the specified fill character (default is a space).
  315. """
  316. return ""
  317.  
  318. def lower(self): # real signature unknown; restored from __doc__
  319. """
  320. S.lower() -> str
  321.  
  322. Return a copy of the string S converted to lowercase.
  323. """
  324. return ""
  325.  
  326. def lstrip(self, chars=None): # real signature unknown; restored from __doc__
  327. """
  328. S.lstrip([chars]) -> str
  329.  
  330. Return a copy of the string S with leading whitespace removed.
  331. If chars is given and not None, remove characters in chars instead.
  332. """
  333. return ""
  334.  
  335. def maketrans(self, *args, **kwargs): # real signature unknown
  336. """
  337. Return a translation table usable for str.translate().
  338.  
  339. If there is only one argument, it must be a dictionary mapping Unicode
  340. ordinals (integers) or characters to Unicode ordinals, strings or None.
  341. Character keys will be then converted to ordinals.
  342. If there are two arguments, they must be strings of equal length, and
  343. in the resulting dictionary, each character in x will be mapped to the
  344. character at the same position in y. If there is a third argument, it
  345. must be a string, whose characters will be mapped to None in the result.
  346. """
  347. pass
  348.  
  349. def partition(self, sep): # real signature unknown; restored from __doc__
  350. """
  351. 以sep为分割,将S分成head,sep,tail三部分
  352.  
  353. S.partition(sep) -> (head, sep, tail)
  354.  
  355. Search for the separator sep in S, and return the part before it,
  356. the separator itself, and the part after it. If the separator is not
  357. found, return S and two empty strings.
  358. """
  359. pass
  360.  
  361. def replace(self, old, new, count=None): # real signature unknown; restored from __doc__
  362. """
  363. S.replace(old, new[, count]) -> str
  364.  
  365. Return a copy of S with all occurrences of substring
  366. old replaced by new. If the optional argument count is
  367. given, only the first count occurrences are replaced.
  368. """
  369. return ""
  370.  
  371. def rfind(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
  372. """
  373. S.rfind(sub[, start[, end]]) -> int
  374.  
  375. Return the highest index in S where substring sub is found,
  376. such that sub is contained within S[start:end]. Optional
  377. arguments start and end are interpreted as in slice notation.
  378.  
  379. Return - on failure.
  380. """
  381. return
  382.  
  383. def rindex(self, sub, start=None, end=None): # real signature unknown; restored from __doc__
  384. """
  385. S.rindex(sub[, start[, end]]) -> int
  386.  
  387. Like S.rfind() but raise ValueError when the substring is not found.
  388. """
  389. return
  390.  
  391. def rjust(self, width, fillchar=None): # real signature unknown; restored from __doc__
  392. """
  393. S.rjust(width[, fillchar]) -> str
  394.  
  395. Return S right-justified in a string of length width. Padding is
  396. done using the specified fill character (default is a space).
  397. """
  398. return ""
  399.  
  400. def rpartition(self, sep): # real signature unknown; restored from __doc__
  401. """
  402. S.rpartition(sep) -> (head, sep, tail)
  403.  
  404. Search for the separator sep in S, starting at the end of S, and return
  405. the part before it, the separator itself, and the part after it. If the
  406. separator is not found, return two empty strings and S.
  407. """
  408. pass
  409.  
  410. def rsplit(self, sep=None, maxsplit=-): # real signature unknown; restored from __doc__
  411. """
  412. S.rsplit(sep=None, maxsplit=-) -> list of strings
  413.  
  414. Return a list of the words in S, using sep as the
  415. delimiter string, starting at the end of the string and
  416. working to the front. If maxsplit is given, at most maxsplit
  417. splits are done. If sep is not specified, any whitespace string
  418. is a separator.
  419. """
  420. return []
  421.  
  422. def rstrip(self, chars=None): # real signature unknown; restored from __doc__
  423. """
  424. S.rstrip([chars]) -> str
  425.  
  426. Return a copy of the string S with trailing whitespace removed.
  427. If chars is given and not None, remove characters in chars instead.
  428. """
  429. return ""
  430.  
  431. def split(self, sep=None, maxsplit=-): # real signature unknown; restored from __doc__
  432. """
  433. 以sep为分割,将S切分成列表,与partition的区别在于切分结果不包含sep,
  434. 如果一个字符串中包含多个sep那么maxsplit为最多切分成几部分
  435. >>> a='a,b c\nd\te'
  436. >>> a.split()
  437. ['a,b', 'c', 'd', 'e']
  438. S.split(sep=None, maxsplit=-) -> list of strings
  439.  
  440. Return a list of the words in S, using sep as the
  441. delimiter string. If maxsplit is given, at most maxsplit
  442. splits are done. If sep is not specified or is None, any
  443. whitespace string is a separator and empty strings are
  444. removed from the result.
  445. """
  446. return []
  447.  
  448. def splitlines(self, keepends=None): # real signature unknown; restored from __doc__
  449. """
  450. Python splitlines() 按照行('\r', '\r\n', \n')分隔,
  451. 返回一个包含各行作为元素的列表,如果参数 keepends 为 False,不包含换行符,如 果为 True,则保留换行符。
  452. >>> x
  453. 'adsfasdf\nsadf\nasdf\nadf'
  454. >>> x.splitlines()
  455. ['adsfasdf', 'sadf', 'asdf', 'adf']
  456. >>> x.splitlines(True)
  457. ['adsfasdf\n', 'sadf\n', 'asdf\n', 'adf']
  458.  
  459. S.splitlines([keepends]) -> list of strings
  460.  
  461. Return a list of the lines in S, breaking at line boundaries.
  462. Line breaks are not included in the resulting list unless keepends
  463. is given and true.
  464. """
  465. return []
  466.  
  467. def startswith(self, prefix, start=None, end=None): # real signature unknown; restored from __doc__
  468. """
  469. S.startswith(prefix[, start[, end]]) -> bool
  470.  
  471. Return True if S starts with the specified prefix, False otherwise.
  472. With optional start, test S beginning at that position.
  473. With optional end, stop comparing S at that position.
  474. prefix can also be a tuple of strings to try.
  475. """
  476. return False
  477.  
  478. def strip(self, chars=None): # real signature unknown; restored from __doc__
  479. """
  480. S.strip([chars]) -> str
  481.  
  482. Return a copy of the string S with leading and trailing
  483. whitespace removed.
  484. If chars is given and not None, remove characters in chars instead.
  485. """
  486. return ""
  487.  
  488. def swapcase(self): # real signature unknown; restored from __doc__
  489. """
  490. 大小写反转
  491. S.swapcase() -> str
  492.  
  493. Return a copy of S with uppercase characters converted to lowercase
  494. and vice versa.
  495. """
  496. return ""
  497.  
  498. def title(self): # real signature unknown; restored from __doc__
  499. """
  500. S.title() -> str
  501.  
  502. Return a titlecased version of S, i.e. words start with title case
  503. characters, all remaining cased characters have lower case.
  504. """
  505. return ""
  506.  
  507. def translate(self, table): # real signature unknown; restored from __doc__
  508. """
  509. table=str.maketrans('alex','big SB')
  510.  
  511. a='hello abc'
  512. print(a.translate(table))
  513.  
  514. S.translate(table) -> str
  515.  
  516. Return a copy of the string S in which each character has been mapped
  517. through the given translation table. The table must implement
  518. lookup/indexing via __getitem__, for instance a dictionary or list,
  519. mapping Unicode ordinals to Unicode ordinals, strings, or None. If
  520. this operation raises LookupError, the character is left untouched.
  521. Characters mapped to None are deleted.
  522. """
  523. return ""
  524.  
  525. def upper(self): # real signature unknown; restored from __doc__
  526. """
  527. S.upper() -> str
  528.  
  529. Return a copy of S converted to uppercase.
  530. """
  531. return ""
  532.  
  533. def zfill(self, width): # real signature unknown; restored from __doc__
  534. """
  535. 原来字符右对齐,不够用0补齐
  536.  
  537. S.zfill(width) -> str
  538.  
  539. Pad a numeric string S with zeros on the left, to fill a field
  540. of the specified width. The string S is never truncated.
  541. """
  542. return ""
  543.  
  544. def __add__(self, *args, **kwargs): # real signature unknown
  545. """ Return self+value. """
  546. pass
  547.  
  548. def __contains__(self, *args, **kwargs): # real signature unknown
  549. """ Return key in self. """
  550. pass
  551.  
  552. def __eq__(self, *args, **kwargs): # real signature unknown
  553. """ Return self==value. """
  554. pass
  555.  
  556. def __format__(self, format_spec): # real signature unknown; restored from __doc__
  557. """
  558. S.__format__(format_spec) -> str
  559.  
  560. Return a formatted version of S as described by format_spec.
  561. """
  562. return ""
  563.  
  564. def __getattribute__(self, *args, **kwargs): # real signature unknown
  565. """ Return getattr(self, name). """
  566. pass
  567.  
  568. def __getitem__(self, *args, **kwargs): # real signature unknown
  569. """ Return self[key]. """
  570. pass
  571.  
  572. def __getnewargs__(self, *args, **kwargs): # real signature unknown
  573. pass
  574.  
  575. def __ge__(self, *args, **kwargs): # real signature unknown
  576. """ Return self>=value. """
  577. pass
  578.  
  579. def __gt__(self, *args, **kwargs): # real signature unknown
  580. """ Return self>value. """
  581. pass
  582.  
  583. def __hash__(self, *args, **kwargs): # real signature unknown
  584. """ Return hash(self). """
  585. pass
  586.  
  587. def __init__(self, value='', encoding=None, errors='strict'): # known special case of str.__init__
  588. """
  589. str(object='') -> str
  590. str(bytes_or_buffer[, encoding[, errors]]) -> str
  591.  
  592. Create a new string object from the given object. If encoding or
  593. errors is specified, then the object must expose a data buffer
  594. that will be decoded using the given encoding and error handler.
  595. Otherwise, returns the result of object.__str__() (if defined)
  596. or repr(object).
  597. encoding defaults to sys.getdefaultencoding().
  598. errors defaults to 'strict'.
  599. # (copied from class doc)
  600. """
  601. pass
  602.  
  603. def __iter__(self, *args, **kwargs): # real signature unknown
  604. """ Implement iter(self). """
  605. pass
  606.  
  607. def __len__(self, *args, **kwargs): # real signature unknown
  608. """ Return len(self). """
  609. pass
  610.  
  611. def __le__(self, *args, **kwargs): # real signature unknown
  612. """ Return self<=value. """
  613. pass
  614.  
  615. def __lt__(self, *args, **kwargs): # real signature unknown
  616. """ Return self<value. """
  617. pass
  618.  
  619. def __mod__(self, *args, **kwargs): # real signature unknown
  620. """ Return self%value. """
  621. pass
  622.  
  623. def __mul__(self, *args, **kwargs): # real signature unknown
  624. """ Return self*value.n """
  625. pass
  626.  
  627. @staticmethod # known case of __new__
  628. def __new__(*args, **kwargs): # real signature unknown
  629. """ Create and return a new object. See help(type) for accurate signature. """
  630. pass
  631.  
  632. def __ne__(self, *args, **kwargs): # real signature unknown
  633. """ Return self!=value. """
  634. pass
  635.  
  636. def __repr__(self, *args, **kwargs): # real signature unknown
  637. """ Return repr(self). """
  638. pass
  639.  
  640. def __rmod__(self, *args, **kwargs): # real signature unknown
  641. """ Return value%self. """
  642. pass
  643.  
  644. def __rmul__(self, *args, **kwargs): # real signature unknown
  645. """ Return self*value. """
  646. pass
  647.  
  648. def __sizeof__(self): # real signature unknown; restored from __doc__
  649. """ S.__sizeof__() -> size of S in memory, in bytes """
  650. pass
  651.  
  652. def __str__(self, *args, **kwargs): # real signature unknown
  653. """ Return str(self). """
  654. pass
  655.  
  656. 字符串工厂函数
  657.  
  658. 字符串工厂函数

字符串工厂函数

  1. num = "" #unicode
  2. num.isdigit() # True
  3. num.isdecimal() # True
  4. num.isnumeric() # True
  5.  
  6. num = "" # 全角
  7. num.isdigit() # True
  8. num.isdecimal() # True
  9. num.isnumeric() # True
  10.  
  11. num = b"" # byte
  12. num.isdigit() # True
  13. num.isdecimal() # AttributeError 'bytes' object has no attribute 'isdecimal'
  14. num.isnumeric() # AttributeError 'bytes' object has no attribute 'isnumeric'
  15.  
  16. num = "IV" # 罗马数字
  17. num.isdigit() # True
  18. num.isdecimal() # False
  19. num.isnumeric() # True
  20.  
  21. num = "四" # 汉字
  22. num.isdigit() # False
  23. num.isdecimal() # False
  24. num.isnumeric() # True
  25.  
  26. ===================
  27. isdigit()
  28. True: Unicode数字,byte数字(单字节),全角数字(双字节),罗马数字
  29. False: 汉字数字
  30. Error:
  31.  
  32. isdecimal()
  33. True: Unicode数字,,全角数字(双字节)
  34. False: 罗马数字,汉字数字
  35. Error: byte数字(单字节)
  36.  
  37. isnumeric()
  38. True: Unicode数字,全角数字(双字节),罗马数字,汉字数字
  39. False:
  40. Error: byte数字(单字节)
  41.  
  42. ================
  43. import unicodedata
  44.  
  45. unicodedata.digit("") #
  46. unicodedata.decimal("") #
  47. unicodedata.numeric("") # 2.0
  48.  
  49. unicodedata.digit("") #
  50. unicodedata.decimal("") #
  51. unicodedata.numeric("") # 2.0
  52.  
  53. unicodedata.digit(b"") # TypeError: must be str, not bytes
  54. unicodedata.decimal(b"") # TypeError: must be str, not bytes
  55. unicodedata.numeric(b"") # TypeError: must be str, not bytes
  56.  
  57. unicodedata.digit("Ⅷ") # ValueError: not a digit
  58. unicodedata.decimal("Ⅷ") # ValueError: not a decimal
  59. unicodedata.numeric("Ⅷ") # 8.0
  60.  
  61. unicodedata.digit("四") # ValueError: not a digit
  62. unicodedata.decimal("四") # ValueError: not a decimal
  63. unicodedata.numeric("四") # 4.0
  64.  
  65. #"〇","零","一","壱","二","弐","三","参","四","五","六","七","八","九","十","廿","卅","卌","百","千","万","万","亿"
  66.  
  67. pythonstr函数isdigitisdecimalisnumeric的区别

python中str函数isdigit、isdecimal、isnumeric的区别

2.2.3 列表

  1. 定义:[]内以逗号分隔,按照索引,存放各种数据类型,每个位置代表一个元素
    特性:
    1.可存放多个值
    2.可修改指定索引位置对应的值,可变
    3.
    按照从左到右的顺序定义列表元素,下标从0开始顺序访问,有序

2.2.3.1 列表创建

  1. list_test=[’lhf‘,12,'ok']

    list_test=list('abc')

    list_test=list([’lhf‘,12,'ok'])

2.2.3.2 列表常用操作

  1. 索引
    切片
    追加
    删除
    长度
    切片
    循环
    包含

2.2.3.3 列表工厂函数list()

  1. class list(object):
  2. """
  3. list() -> new empty list
  4. list(iterable) -> new list initialized from iterable's items
  5. """
  6. def append(self, p_object): # real signature unknown; restored from __doc__
  7. """ L.append(object) -> None -- append object to end """
  8. pass
  9.  
  10. def clear(self): # real signature unknown; restored from __doc__
  11. """ L.clear() -> None -- remove all items from L """
  12. pass
  13.  
  14. def copy(self): # real signature unknown; restored from __doc__
  15. """ L.copy() -> list -- a shallow copy of L """
  16. return []
  17.  
  18. def count(self, value): # real signature unknown; restored from __doc__
  19. """ L.count(value) -> integer -- return number of occurrences of value """
  20. return
  21.  
  22. def extend(self, iterable): # real signature unknown; restored from __doc__
  23. """ L.extend(iterable) -> None -- extend list by appending elements from the iterable """
  24. pass
  25.  
  26. def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
  27. """
  28. L.index(value, [start, [stop]]) -> integer -- return first index of value.
  29. Raises ValueError if the value is not present.
  30. """
  31. return
  32.  
  33. def insert(self, index, p_object): # real signature unknown; restored from __doc__
  34. """ L.insert(index, object) -- insert object before index """
  35. pass
  36.  
  37. def pop(self, index=None): # real signature unknown; restored from __doc__
  38. """
  39. L.pop([index]) -> item -- remove and return item at index (default last).
  40. Raises IndexError if list is empty or index is out of range.
  41. """
  42. pass
  43.  
  44. def remove(self, value): # real signature unknown; restored from __doc__
  45. """
  46. L.remove(value) -> None -- remove first occurrence of value.
  47. Raises ValueError if the value is not present.
  48. """
  49. pass
  50.  
  51. def reverse(self): # real signature unknown; restored from __doc__
  52. """ L.reverse() -- reverse *IN PLACE* """
  53. pass
  54.  
  55. def sort(self, key=None, reverse=False): # real signature unknown; restored from __doc__
  56. """ L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* """
  57. pass
  58.  
  59. def __add__(self, *args, **kwargs): # real signature unknown
  60. """ Return self+value. """
  61. pass
  62.  
  63. def __contains__(self, *args, **kwargs): # real signature unknown
  64. """ Return key in self. """
  65. pass
  66.  
  67. def __delitem__(self, *args, **kwargs): # real signature unknown
  68. """ Delete self[key]. """
  69. pass
  70.  
  71. def __eq__(self, *args, **kwargs): # real signature unknown
  72. """ Return self==value. """
  73. pass
  74.  
  75. def __getattribute__(self, *args, **kwargs): # real signature unknown
  76. """ Return getattr(self, name). """
  77. pass
  78.  
  79. def __getitem__(self, y): # real signature unknown; restored from __doc__
  80. """ x.__getitem__(y) <==> x[y] """
  81. pass
  82.  
  83. def __ge__(self, *args, **kwargs): # real signature unknown
  84. """ Return self>=value. """
  85. pass
  86.  
  87. def __gt__(self, *args, **kwargs): # real signature unknown
  88. """ Return self>value. """
  89. pass
  90.  
  91. def __iadd__(self, *args, **kwargs): # real signature unknown
  92. """ Implement self+=value. """
  93. pass
  94.  
  95. def __imul__(self, *args, **kwargs): # real signature unknown
  96. """ Implement self*=value. """
  97. pass
  98.  
  99. def __init__(self, seq=()): # known special case of list.__init__
  100. """
  101. list() -> new empty list
  102. list(iterable) -> new list initialized from iterable's items
  103. # (copied from class doc)
  104. """
  105. pass
  106.  
  107. def __iter__(self, *args, **kwargs): # real signature unknown
  108. """ Implement iter(self). """
  109. pass
  110.  
  111. def __len__(self, *args, **kwargs): # real signature unknown
  112. """ Return len(self). """
  113. pass
  114.  
  115. def __le__(self, *args, **kwargs): # real signature unknown
  116. """ Return self<=value. """
  117. pass
  118.  
  119. def __lt__(self, *args, **kwargs): # real signature unknown
  120. """ Return self<value. """
  121. pass
  122.  
  123. def __mul__(self, *args, **kwargs): # real signature unknown
  124. """ Return self*value.n """
  125. pass
  126.  
  127. @staticmethod # known case of __new__
  128. def __new__(*args, **kwargs): # real signature unknown
  129. """ Create and return a new object. See help(type) for accurate signature. """
  130. pass
  131.  
  132. def __ne__(self, *args, **kwargs): # real signature unknown
  133. """ Return self!=value. """
  134. pass
  135.  
  136. def __repr__(self, *args, **kwargs): # real signature unknown
  137. """ Return repr(self). """
  138. pass
  139.  
  140. def __reversed__(self): # real signature unknown; restored from __doc__
  141. """ L.__reversed__() -- return a reverse iterator over the list """
  142. pass
  143.  
  144. def __rmul__(self, *args, **kwargs): # real signature unknown
  145. """ Return self*value. """
  146. pass
  147.  
  148. def __setitem__(self, *args, **kwargs): # real signature unknown
  149. """ Set self[key] to value. """
  150. pass
  151.  
  152. def __sizeof__(self): # real signature unknown; restored from __doc__
  153. """ L.__sizeof__() -- size of L in memory, in bytes """
  154. pass
  155.  
  156. __hash__ = None
  157.  
  158. 查看

查看

2.2.4 元组

  1. 定义:与列表类似,只不过[]改成()
    特性:
  1. 1.可存放多个值
    2.不可变
    3.
    按照从左到右的顺序定义元组元素,下标从0开始顺序访问,有序

2.2.4.1 元组创建

  1. ages = (11, 22, 33, 44, 55)

    ages = tuple((11, 22, 33, 44, 55))

2.2.4.2 元组常用操作

  1. 索引
    切片
    循环
    长度
    包含

2.2.4.3 元组工厂函数tuple()

2.2.5 字典

  1. 定义:{key1:value1,key2:value2},key-value结构,key必须可hash
    特性:
  1. 1.可存放多个值
    2.可修改指定key对应的值,可变
    3.

2.2.5.1 字典创建

  1. person = {"name": "sb", 'age': 18}

    person = dict(name='sb', age=18)
    person = dict({"name": "sb", 'age': 18})
    person = dict((['name','sb'],['age',18]))
    {}.fromkeys(seq,100) #不指定100默认为None
    注意:
  1. >>> dic={}.fromkeys(['k1','k2'],[])
  2. >>> dic
  3. {'k1': [], 'k2': []}
  4. >>> dic['k1'].append(1)
  5. >>> dic
  6. {'k1': [1], 'k2': [1]} 

2.2.5.2 字典常用操作

  1. 索引
    新增
    删除
    键、值、键值对
    循环
    长度

2.2.5.3 字典工厂函数dict()

2.2.6 集合

  1. 定义:由不同元素组成的集合,集合中是一组无序排列的可hash值,可以作为字典的key
    特性:
    1.集合的目的是将不同的值存放到一起,不同的集合间用来做关系运算,无需纠结于集合中单个值

2.2.6.1 集合创建

  1. {1,2,3,1}

    定义可变集合set
    >>> set_test=set('hello')
    >>> set_test
    {'l', 'o', 'e', 'h'}
    改为不可变集合frozenset
    >>> f_set_test=frozenset(set_test)
    >>> f_set_test
    frozenset({'l', 'e', 'h', 'o'})

2.2.6.2 集合常用操作:关系运算

  1.    in
    not in
    ==
    !=
    <,<=
    >,>=
    |,|=:合集
    &.&=:交集
    -,-=:差集
    ^,^=:对称差分

2.2.6.3 集合工厂函数set()

  1. class set(object):
  2. """
  3. set() -> new empty set object
  4. set(iterable) -> new set object
  5.  
  6. Build an unordered collection of unique elements.
  7. """
  8. def add(self, *args, **kwargs): # real signature unknown
  9. """
  10. Add an element to a set.
  11.  
  12. This has no effect if the element is already present.
  13. """
  14. pass
  15.  
  16. def clear(self, *args, **kwargs): # real signature unknown
  17. """ Remove all elements from this set. """
  18. pass
  19.  
  20. def copy(self, *args, **kwargs): # real signature unknown
  21. """ Return a shallow copy of a set. """
  22. pass
  23.  
  24. def difference(self, *args, **kwargs): # real signature unknown
  25. """
  26. 相当于s1-s2
  27.  
  28. Return the difference of two or more sets as a new set.
  29.  
  30. (i.e. all elements that are in this set but not the others.)
  31. """
  32. pass
  33.  
  34. def difference_update(self, *args, **kwargs): # real signature unknown
  35. """ Remove all elements of another set from this set. """
  36. pass
  37.  
  38. def discard(self, *args, **kwargs): # real signature unknown
  39. """
  40. 与remove功能相同,删除元素不存在时不会抛出异常
  41.  
  42. Remove an element from a set if it is a member.
  43.  
  44. If the element is not a member, do nothing.
  45. """
  46. pass
  47.  
  48. def intersection(self, *args, **kwargs): # real signature unknown
  49. """
  50. 相当于s1&s2
  51.  
  52. Return the intersection of two sets as a new set.
  53.  
  54. (i.e. all elements that are in both sets.)
  55. """
  56. pass
  57.  
  58. def intersection_update(self, *args, **kwargs): # real signature unknown
  59. """ Update a set with the intersection of itself and another. """
  60. pass
  61.  
  62. def isdisjoint(self, *args, **kwargs): # real signature unknown
  63. """ Return True if two sets have a null intersection. """
  64. pass
  65.  
  66. def issubset(self, *args, **kwargs): # real signature unknown
  67. """
  68. 相当于s1<=s2
  69.  
  70. Report whether another set contains this set. """
  71. pass
  72.  
  73. def issuperset(self, *args, **kwargs): # real signature unknown
  74. """
  75. 相当于s1>=s2
  76.  
  77. Report whether this set contains another set. """
  78. pass
  79.  
  80. def pop(self, *args, **kwargs): # real signature unknown
  81. """
  82. Remove and return an arbitrary set element.
  83. Raises KeyError if the set is empty.
  84. """
  85. pass
  86.  
  87. def remove(self, *args, **kwargs): # real signature unknown
  88. """
  89. Remove an element from a set; it must be a member.
  90.  
  91. If the element is not a member, raise a KeyError.
  92. """
  93. pass
  94.  
  95. def symmetric_difference(self, *args, **kwargs): # real signature unknown
  96. """
  97. 相当于s1^s2
  98.  
  99. Return the symmetric difference of two sets as a new set.
  100.  
  101. (i.e. all elements that are in exactly one of the sets.)
  102. """
  103. pass
  104.  
  105. def symmetric_difference_update(self, *args, **kwargs): # real signature unknown
  106. """ Update a set with the symmetric difference of itself and another. """
  107. pass
  108.  
  109. def union(self, *args, **kwargs): # real signature unknown
  110. """
  111. 相当于s1|s2
  112.  
  113. Return the union of sets as a new set.
  114.  
  115. (i.e. all elements that are in either set.)
  116. """
  117. pass
  118.  
  119. def update(self, *args, **kwargs): # real signature unknown
  120. """ Update a set with the union of itself and others. """
  121. pass
  122.  
  123. def __and__(self, *args, **kwargs): # real signature unknown
  124. """ Return self&value. """
  125. pass
  126.  
  127. def __contains__(self, y): # real signature unknown; restored from __doc__
  128. """ x.__contains__(y) <==> y in x. """
  129. pass
  130.  
  131. def __eq__(self, *args, **kwargs): # real signature unknown
  132. """ Return self==value. """
  133. pass
  134.  
  135. def __getattribute__(self, *args, **kwargs): # real signature unknown
  136. """ Return getattr(self, name). """
  137. pass
  138.  
  139. def __ge__(self, *args, **kwargs): # real signature unknown
  140. """ Return self>=value. """
  141. pass
  142.  
  143. def __gt__(self, *args, **kwargs): # real signature unknown
  144. """ Return self>value. """
  145. pass
  146.  
  147. def __iand__(self, *args, **kwargs): # real signature unknown
  148. """ Return self&=value. """
  149. pass
  150.  
  151. def __init__(self, seq=()): # known special case of set.__init__
  152. """
  153. set() -> new empty set object
  154. set(iterable) -> new set object
  155.  
  156. Build an unordered collection of unique elements.
  157. # (copied from class doc)
  158. """
  159. pass
  160.  
  161. def __ior__(self, *args, **kwargs): # real signature unknown
  162. """ Return self|=value. """
  163. pass
  164.  
  165. def __isub__(self, *args, **kwargs): # real signature unknown
  166. """ Return self-=value. """
  167. pass
  168.  
  169. def __iter__(self, *args, **kwargs): # real signature unknown
  170. """ Implement iter(self). """
  171. pass
  172.  
  173. def __ixor__(self, *args, **kwargs): # real signature unknown
  174. """ Return self^=value. """
  175. pass
  176.  
  177. def __len__(self, *args, **kwargs): # real signature unknown
  178. """ Return len(self). """
  179. pass
  180.  
  181. def __le__(self, *args, **kwargs): # real signature unknown
  182. """ Return self<=value. """
  183. pass
  184.  
  185. def __lt__(self, *args, **kwargs): # real signature unknown
  186. """ Return self<value. """
  187. pass
  188.  
  189. @staticmethod # known case of __new__
  190. def __new__(*args, **kwargs): # real signature unknown
  191. """ Create and return a new object. See help(type) for accurate signature. """
  192. pass
  193.  
  194. def __ne__(self, *args, **kwargs): # real signature unknown
  195. """ Return self!=value. """
  196. pass
  197.  
  198. def __or__(self, *args, **kwargs): # real signature unknown
  199. """ Return self|value. """
  200. pass
  201.  
  202. def __rand__(self, *args, **kwargs): # real signature unknown
  203. """ Return value&self. """
  204. pass
  205.  
  206. def __reduce__(self, *args, **kwargs): # real signature unknown
  207. """ Return state information for pickling. """
  208. pass
  209.  
  210. def __repr__(self, *args, **kwargs): # real signature unknown
  211. """ Return repr(self). """
  212. pass
  213.  
  214. def __ror__(self, *args, **kwargs): # real signature unknown
  215. """ Return value|self. """
  216. pass
  217.  
  218. def __rsub__(self, *args, **kwargs): # real signature unknown
  219. """ Return value-self. """
  220. pass
  221.  
  222. def __rxor__(self, *args, **kwargs): # real signature unknown
  223. """ Return value^self. """
  224. pass
  225.  
  226. def __sizeof__(self): # real signature unknown; restored from __doc__
  227. """ S.__sizeof__() -> size of S in memory, in bytes """
  228. pass
  229.  
  230. def __sub__(self, *args, **kwargs): # real signature unknown
  231. """ Return self-value. """
  232. pass
  233.  
  234. def __xor__(self, *args, **kwargs): # real signature unknown
  235. """ Return self^value. """
  236. pass
  237.  
  238. __hash__ = None
  239.  
  240. 查看
  241.  
  242. 查看

查看

2.2.7 bytes类型

定义:存8bit整数,数据基于网络传输或内存变量存储到硬盘时需要转成bytes类型,字符串前置b代表为bytes类型

  1. >>> x
  2. 'hello sb'
  3. >>> x.encode('gb2312')
  4. b'hello sb'
 

2.2.8 数据类型转换内置函数汇总

注:真对acsii表unichr在python2.7中比chr的范围更大,python3.*中chr内置了unichar

三.运算符

1、算数运算:

2、比较运算:

3、赋值运算:

4、位运算:

注: ~  举例: ~5 = -6  解释: 将二进制数+1之后乘以-1,即~x = -(x+1),-(101 + 1) = -110

按位反转仅能用在数字前面。所以写成 3+~5 可以得到结果-3,写成3~5就出错了

5、逻辑运算:

and注解:

  1. 在Python 中,and 和 or 执行布尔逻辑演算,如你所期待的一样,但是它们并不返回布尔值;而是,返回它们实际进行比较的值之一。
  2. 在布尔上下文中从左到右演算表达式的值,如果布尔上下文中的所有值都为真,那么 and 返回最后一个值。
  3. 如果布尔上下文中的某个值为假,则 and 返回第一个假值

or注解:

  1. 使用 or 时,在布尔上下文中从左到右演算值,就像 and 一样。如果有一个值为真,or 立刻返回该值
  2. 如果所有的值都为假,or 返回最后一个假值
  3. 注意 or 在布尔上下文中会一直进行表达式演算直到找到第一个真值,然后就会忽略剩余的比较值

and-or结合使用:

  1. 结合了前面的两种语法,推理即可。
  2. 为加强程序可读性,最好与括号连用,例如:
    1. 1 and 'x') or 'y'

6、成员运算:

7.身份运算

 

8.运算符优先级:自上而下,优先级从高到低

四.标准数据类型特性总结

按存值个数区分

标量/原子类型 数字,字符串
容器类型 列表,元组,字典

按可变不可变区分

可变 列表,字典
不可变 数字,字符串,元组

按访问顺序区分

直接访问 数字
顺序访问(序列类型) 字符串,列表,元组
key值访问(映射类型) 字典

第二篇.1、python基础之数据类型与变量的更多相关文章

  1. 第三篇:python基础之数据类型与变量

    阅读目录 一.变量 二.数据类型 2.1 什么是数据类型及数据类型分类 2.2 标准数据类型: 2.2.1 数字 2.2.1.1 整型: 2.2.1.2 长整型long: 2.2.1.3 布尔bool ...

  2. Python成长之路【第二篇】Python基础之数据类型

    阅读目录 简介 1 什么是数据? x=10,10是我们要存储的数据 2 为何数据要分不同的类型 数据是用来表示状态的,不同的状态就应该用不同的类型的数据去表示 3 数据类型 数字(整形,长整形,浮点型 ...

  3. 第二章:python基础,数据类型

    """第二章:python基础,数据类型2.1 变量及身份运算补充2.2 二进制数2.3 字符编码每8位所占的空间位一个比特,这是计算机中最小的表示单位.每8个比特组成一 ...

  4. python开发第二篇 :python基础

    python基础a.Python基础      -基础1. 第一句python       -python后缀名可以任意?     -导入模块时如果不是.py文件,以后的文件后缀名是.py.2.两种 ...

  5. Python之路【第二篇】:Python基础

    Python基础 对于Python,一切事物都是对象,对象基于类创建 所以,以下这些值都时对象:"zhurui".22.['北京','上海','深圳'],并且是根据不同的类生成的对 ...

  6. 第二篇:python基础之文件读写

    python基础之文件读写   python基础之文件读写 本节内容 os模块中文件以及目录的一些方法 文件的操作 目录的操作 1.os模块中文件以及目录的一些方法 python操作文件以及目录可以使 ...

  7. 第二篇:python基础之核心风格

    阅读目录 一.语句和语法 二.变量定义与赋值 三.内存管理 内存管理: 引用计数: 简单例子 四.python对象 五.标识符 六.专用下划线标识符 七.编写模块基本风格 八.示范 一.语句和语法 # ...

  8. python学习第三天:python基础(数据类型和变量)

    注释 以  # 开头的语句是注释,如,注释不会被编译运行: 格式 当语句以冒号:结尾时,缩进的语句视为代码块.按照约定俗成的管理,应该始终坚持使用4个空格的缩进(在文本编辑器中,需要设置把Tab自动转 ...

  9. Python基础之数据类型和变量

    数据类型 ​ 计算机顾名思义就是可以做数学机器,可以处理各种数值,计算机还能处理文本.图形.音频.视频.网页等各种各样的数据,不同的数据是需要定义不同的数据类型的,在Python中,能够直接处理的数据 ...

随机推荐

  1. javascript控制流程语句

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. WPF/ASP.NET:几个Prism中的术语

    Prism 棱镜 Bootstrapper 启动器 dependency injection 依赖注入 regions 区域 navigation 导航 shell  壳

  3. Ubuntu16.04源

    vim /etc/apt/sources.list # 阿里云deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420. ...

  4. jmeter beanShell修改http请求参数

    jmeter beanShell修改http请求参数 在使用jmeter进行测试时,需要对上一步响应的明文参数,如userName='tom' token='%sdf%sdkdfj'之类的参数,加密一 ...

  5. zabbix(2)使用指南

    一.邮件报警(一个客户端安装server,agent) 管理->报警媒介类型->email 管理->用户->Admin->报警媒介 配置->动作->Repor ...

  6. spring boot系列(一)spring boot 初识

    什么是spring boot Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员 ...

  7. [iOS]UIWebView返回和NSURLErrorDomain-999

    1.UIWebView实现返回不崩溃: -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)r ...

  8. shutil使用

    1.用shutil移动文件, import shutil shutil.move('/root/test.yaml','/home/') shutil.move('/root/k8s.py','/ho ...

  9. [转帖]深入浅出全面解析RDMA

    深入浅出全面解析RDMA 置顶 2018年06月04日 11:36:54 MasterT-J 阅读数 17193更多 所属专栏: RDMA   RDMA(RemoteDirect Memory Acc ...

  10. python装饰器的原理

    装饰器的原理就是利用<闭包函数>来实现,闭包函数的原理就是包含内层函数的return和外层环境变量: