function split(s, delim) then return end local t = {} while true do local pos = string.find (s, delim, start, true) -- plain find if not pos then break end )) start = pos + string.len (delim) end table.insert (t, string.sub (s, start)) return t end
在C语言中,我们使用printf("%s","hello")这种形式进行字符串的拼接 在python中,进行这样的拼接有两种实现方式,分别是%号拼接以及使用format函数,以下进行代码演示 %号拼接字符串 在python中是用%号可以进行字符串的拼接,这个跟print函数是无关的.以下进行举例 打印字符串 msg = "i am %s,my blogs is %s" % ("CodeScrew","www.cnbl