展开全部
a=1
b=10
f=''.join(open("C:\\Users\\Administrator\\Desktop\\ID.txt").readlines()[a:b])
print f
使用bai连接符: +
world = "World"
print "Hello " + world + " ! "
2. 使用占位符du来内插
world = "World"
print "Hello %s !" % world
3.如何使用函zhi数
li = ['my','name','is','bob']
mystr = ' '.join(li)
print mystr
4.上面的语句中字符串是作dao为参数传专入的,可以直接用变属量替换:
begin_date = '2012-04-06 00:00:00'
end_date = '2012-04-06 23:59:59'
select * from usb where time between to_date(begin_date,'YYYY-MM-DD HH24:MI:SS') and to_date(end_date,'YYYY-MM-DD HH24:MI:SS')
ython 怎么在字符串中使用变量