返回不同值的小技巧
>>> hobbies = ['software'] >>> ('notchecked', 'checked')['software' in hobbies] 'checked' >>> 'checked' if 'software' in hobbies else 'notchecked' 'checked' >>> hobbies = ['xxx'] >>> 'checked' if 'software' in hobbies else 'notchecked' 'notchecked' >>>