摘要: import os os.path.isfile('test.txt') # 如果不存在就返回False os.path.exists(directory) # 如果目录不存在就返回Falseos.makedirs(targetDir) os.path.join(targetDir, fi... 阅读全文
posted @ 2014-03-21 21:25 emanlee 阅读(838) 评论(0) 推荐(0)
摘要: 生成字符串变量str='python String function' 字符串长度获取:len(str)例:print '%s length=%d' % (str,len(str))连接字符串sStr1 = 'strcat'sStr2 = 'append'sStr1 += sStr2print sS 阅读全文
posted @ 2014-03-21 21:20 emanlee 阅读(40556) 评论(1) 推荐(4)
摘要: 1.格式化输出整数python print也支持参数格式化,与C言的printf似,strHello = "the length of (%s) is %d" %(Hello World,len(Hello World))print strHello#输出果:the length of (Hello... 阅读全文
posted @ 2014-03-21 18:57 emanlee 阅读(846) 评论(0) 推荐(0)