1. 使用连接符: +world = "World"print "Hello " + world + " ! "2. 使用占位符来内插world = "World"print "Hello %s !" % world3. 使用函数li = ['my','name','is','bob']mystr = ' '.join(li)print mystr上面的语句中字符串是作为参数传入的,可以直接用变量替换:
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')