Ray's playground

 

2010年12月17日

Recipe 1.3. Testing Whether an Object Is String-like(Python Cookbook)

摘要: isAStringCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1defisAString(anobj):2returnisinstance(anobj,basestring)34a="hello"5isAString(a)6True7b='t'8isAString(b)9True10c=[]11isAString(c)12False13classMyString(str):14pass1516 阅读全文

posted @ 2010-12-17 22:29 Ray Z 阅读(108) 评论(0) 推荐(0) 编辑

导航