python 与cad_Python的应用场景和优劣势是啥?&数据类型:Python学习系列6

Python能应用场景与优缺点

Python擅长做的几件事:系统运维

网络编程

科学计算

教学

AI

优点:纯面向对象

移植性好

可混合编程(胶水语言)

开发效率高

缺点:运行速度慢

Python的数据类型数字类型:整数、浮点数、

字符串类型

布尔类型

空值NONE

数字类型-整数

数字类型包括:

整数之间的数制转换

数字类型-浮点数(小数)

字符串类型数字不用引号引起来,但字符串需要;在注释部分,引号里面的都是字符串

单引号和双引号的作用一样。

三单引号和三双引号作用一样。

三单引号和三双引号出现的目的是解决引号中的引号问题

例如''' Let's Go!'''

当然,我们也可以用转义符来解决类似字符串中的引号问题。

转义字符还有其他几种:

字符串类型的API-一般函数

针对一般函数的描述,我们可以使用命令行查看:

Help on class str in module builtins:

class str(object)

|  str(object='') -> str

|  str(bytes_or_buffer[, encoding[, errors]]) -> str

|

|  Create a new string object from the given object. If encoding or

|  errors is specified, then the object must expose a data buffer

|  that will be decoded using the given encoding and error handler.

|  Otherwise, returns the result of object.__str__() (if defined)

|  or repr(object).

|  encoding defaults to sys.getdefaultencoding().

|  errors defaults to 'strict'.

|

|  Methods defined here:

|

|  __add__(self, value, /)

|      Return self+value.

|

|  __contains__(self, key, /)

|      Return key in self.

|

|  __eq__(self, value, /)

|      Return self==value.

|

|  __format__(self, format_spec, /)

|      Return a formatted version of the string as described by format_spec.

|

|  __ge__(self, value, /)

|      Return self>=value.

|

|  __getattribute__(self, name, /)

|      Return getattr(self, name).

|

|  __getitem__(self, key, /)

|      Return self[key].

|

|  __getnewargs__(...)

|

|  __gt__(self, value, /)

|      Return self>value.

|

|  __hash__(self, /)

|      Return hash(self).

|

|  __iter__(self, /)

|      Implement iter(self).

|

|  __le__(self, value, /)

|      Return self<=value.

|

|  __len__(self, /)

|      Return len(self).

|

|  __lt__(self, value, /)

|      Return self

|

|  __mod__(self, value, /)

|      Return self%value.

|

|  __mul__(self, value, /)

|      Return self*value.

|

|  __ne__(self, value, /)

|      Return self!=value.

|

|  __repr__(self, /)

|      Return repr(self).

|

|  __rmod__(self, value, /)

|      Return value%self.

|

|  __rmul__(self, value, /)

|      Return value*self.

|

|  __sizeof__(self, /)

|      Return the size of the string in memory, in bytes.

|

|  __str__(self, /)

|      Return str(self).

|

|  capitalize(self, /)

|      Return a capitalized version of the string.

|

|      More specifically, make the first character have upper case and the rest lower

|      case.

|

|  casefold(self, /)

|      Return a version of the string suitable for caseless comparisons.

|

|  center(self, width, fillchar=' ', /)

|      Return a centered string of length width.

|

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值