我有这个简单的Python表达式:
fscript.write (("update %s va set %s = %s where %s = %s;") % (argv[1],argv[2],vl[0],argv[3],vl[1]))
我希望收到这样的输出
update some_table va set active_id = 1 where id = 5;
update some_table va set active_id = 1 where id = 3;
...more lines...
但是,我明白了
update some_table va set active_id = 1 where id = 5
;update some_table va set active_id = 1 where id = 3
...more lines....
我缺少什么吗?
提前致谢
最佳答案
我会尝试将 strip()
添加到您最新的参数中,该参数可能以 \n
结尾。
fscript.write (("update %s va set %s = %s where %s = %s;") % (argv[1],argv[2],vl[0],argv[3],vl[1].strip()))
关于python + 写入文件的分号写在下一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3449358/