我正在尝试创建一个表生成器。但是,当我在Python中执行此操作时
$("#menuwrapper").find("ul>li>ul>li").click(function (event) {
if (event.stopPropagation === "function") { event.stopPropagation(); }
var talukname = this.id;
GetTalukReport(talukname);
showTalukresults(talukname);
});
table.write将写入文件
这就是我得到的。
create_query += 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'\t\'\n'
table.write(create_query)
我假设空格是实际的TAB
然而我想要的是这个。
ROW FORMAT DELIMITED FIELDS TERMINATED BY ' '
答案 0 :(得分:2)
对字符串作为一个整体使用双引号,并转义反斜杠:
create_query += "ROW FORMAT DELIMITED FIELDS TERMINATED BY '\\t'\n"
答案 1 :(得分:1)
您可以使用raw string:
create_query += r"ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'" + "\n"