Python论坛  - 讨论区

标题:Re: [python-chinese] python中关于表达式的疑问,请教

2005年07月18日 星期一 17:52

Qutr qutianrang at gmail.com
Mon Jul 18 17:52:24 HKT 2005

„¢ÀÚ£¬ÄãºÃ
print msg[7:] == '' 
Ï൱ÓÚ print (msg[7:] == '') ÊǸöÂß¼­Öµ
¶ømsg[7:]ÊÇÒ»¸ö×Ö·û¡£
ËùÒÔ
if msg[7:]:
    print 'ok' # È´ÓÖ´òÓ¡²»³öok×ÖÑù

Qutr £¬ qutianrang at gmail.com 
2005-7-18 
----- ÊÕµ½ÒÔÏÂÀ´ÐÅÄÚÈÝ ----- 
·¢¼þÈË: „¢ÀÚ 
ÊÕ¼þÈË: python-chinese 
ʱ  ¼ä: 2005-07-18, 16:29:47
Ö÷  Ìâ: [python-chinese] pythonÖйØÓÚ±í´ïʽµÄÒÉÎÊ£¬Çë½Ì


msg = 'hello'
print msg[7:] == '' # ´òÓ¡True
µ«ÊÇ
if msg[7:]:
    print 'ok' # È´ÓÖ´òÓ¡²»³öok×ÖÑù£¬²»Ã÷°×

_______________________________________________
python-chinese list
python-chinese at lists.python.cn
http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050718/0a5f0b51/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号