int ----> bool

int  ----> bool   非零转换成bool True   0 转换成bool 是False

int --->bool
  print(bool(2))
  print(bool(-2))
  print(bool(0))
#bool --->int
  print(int(True)) # 1
  print(int(False)) # 0

 

posted @ 2019-06-14 16:28  WuKongSir  阅读(28)  评论(0)    收藏  举报