ITeye博客

python

共 2 篇文章

基础(2)

//未定义变量,操作报异常 try: li if len(li) == 0: print 'ok' except: print 'fail' ------------------------------------------------------------------------------------------- //输出格式 k = "uid" v = "sa" print "%s=%s" % (k,v) ----------------------------------------------------------------------------------------…

2010-01-21 16:09 · python

基础(1)

模块导入: xx.py def getName(): return "xuxu" yy.py //调用方法与java的类调用相同 import xx ret = xx.getName() print ret ------------------------------------------------------------------------------------------- def testList(): typeList = [] typeList.append("a") return typeList ll=testList() print ll -------------…

2010-01-21 16:08 · python