1. 使用連線符: +
world = "World"
print "Hello " + world + " ! "
2. 使用佔位符來內插
print "Hello %s !" % world
3. 使用函式
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")
1. 使用連線符: +
world = "World"
print "Hello " + world + " ! "
2. 使用佔位符來內插
world = "World"
print "Hello %s !" % world
3. 使用函式
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")