- 博客(3)
- 收藏
- 关注
原创 【python】file.write() 和 open()
file.write()参数只接受str,所以如果想以格式化的方式作为参数写入文件的话,就需要用的str()函数了,例如“:target.write(str("The second formate\n %s\n%s\n%s\n") %(line1,line2,line3))关于open()open 有 'w', 'r','+' 以及 ‘a' 模式。w 没有
2013-09-29 13:14:57 4496
转载 【python】raw_input() 和input()
raw_input() 与 input() __ Python这两个均是 python 的内建函数,通过读取控制台的输入与用户实现交互。但他们的功能不尽相同。举两个小例子。 1 >>> raw_input_A = raw_input("raw_input: ") 2 raw_input: abc 3 >>> input_A = input("Input: ") 4 Inpu
2013-09-28 15:40:59 402
原创 【Python 】奇怪的引号
do_like= "do'like"binary="binary" #stringdo_not="don't" #stringx="there are types of people and %s" %("do'like")y="those who know %s and those who %s" %(binary,do_not) print "i said: '%s ' " %xp
2013-09-26 22:01:50 422
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人