
Python
yuanyuanprince
这个作者很懒,什么都没留下…
展开
-
《python核心编程》读书笔记一 欢迎来到python世界
很多shell脚本语言使用echo命令来输出程序结果。>>> myString='Hello World!'>>> print myStringHello World!>>> myString'Hello World!'>>> _ //下划线(_)在解释器中有特别的含义,表示最后一个表达式的值。'Hello World!'>>> print原创 2012-05-11 17:47:24 · 626 阅读 · 1 评论 -
创建文件,文件读取与显示
#!usr/bin/env python'makeTextFile.py -- create text file'import osls=os.linesep#get filenamewhile True: fname=raw_input('Enter filename:') if(os.path.exists(fname)):原创 2012-05-14 08:54:49 · 387 阅读 · 0 评论 -
检测类型
#!/usr/bin/env pythondef displayNumType(num): print num,'is', if isinstance(num,(int,long,float,complex)): print 'a number of type:',type(num).__name__ else:原创 2012-05-14 10:23:01 · 253 阅读 · 0 评论