TypeError: not enough arguments for format string

在python里用run方式调用

dbs = """
    stk = select * from stk where ts_code like "204%.SH"
    """
s.run(dbs)


会报错TypeError: not enough arguments for format string。请问这个应该怎么改才可以正常运行?

请先 登录 后评论

1 个回答

saki

like 中的 % 会被 python 解析为格式化字符串的标识符,要么使用 %% 进行转义,要么就使用 r"..."  告诉编译器这个string是个raw string,不要转义。

请先 登录 后评论