# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:happy_code
@email: happy_code@foxmail.com
@file: ifTest.py
@time: 2018/12/03
"""
a = ''
b = None
c = ' '
d = False
e = {}
f = []
g = ()
h = True
i = 1
j = object
if a:
print('空串')
if b:
print('None')
if c:
print('空格字符串')
if d:
print('False')
if e:
print('空dict')
if f:
print('空list')
if g:
print('空tuple')
if h:
print('True')
if i:
print('1')
if j:
print('class')
结果
空格字符串
True
1
class