#!/usr/bin/env python
# _*_ coding:utf-8 _*_
# Author:CarsonLi
'''
    断言一般用于后面有非常重要的操作,需要使用前面的数据,而且不容许出错
    这里就用的到断言,也可以用
'''
name="Bert"

assert type(name) is str
print("断言name是str类型")

assert type(name) is not int
print("断言不是int 类型")

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2021-04-01
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-22
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
相关资源
相似解决方案