我可以使用variante作为名称在MYSQLdb中创建一个新表吗?

时间:2017-06-28 07:12:52

标签: python variables web-scraping mysql-python

我有这个html来源:

Definition in_parens (stm : string) : string := "(" ++ stm ++ ")".

Fixpoint pprint (tm : term) : string :=
  match tm with
  | Var id => id
  | Abs id tm1 =>
    let fix pprint_nested_abs (tm : term) : string :=
        match tm with
        | Abs id tm1 => id ++ pprint_nested_abs tm1
        | _ => ". " ++ pprint tm
        end
    in
    "\" ++ id ++ pprint_nested_abs tm1

  (* e.g. (\x. x x) (\x. x x) *)
  | App ((Abs _ _) as tm1) ((Abs _ _) as tm2) =>     
      in_parens (pprint tm1) ++ " " ++ in_parens (pprint tm2)

  (* variable scopes *)
  | App ((Abs _ _) as tm1) tm2 => in_parens (pprint tm1) ++ " " ++ pprint tm2

  (* `x \x. x` looks ugly, `x (\x. x)` is better; also handle `x (y z)` *) 
  | App tm1 ((Abs _ _) as tm2) | App tm1 (App _ _ as tm2) =>
      pprint tm1 ++ " " ++ in_parens (pprint tm2)

  | App tm1 tm2 => pprint tm1 ++ " " ++ pprint tm2
  end.

我想使用这个值:THE_NAME作为variante(或constante,无关紧要),我可以在MYSQL中定义表名。

<div id="ceg">
        <span class="cegnev">THE_NAME</span><br>
        <span class="cim">XXX</span><br>
       YYY  </div>

如何使用这部分html代码创建变量,如何在查询代码中引用此名称?可能吗? - Python 2.7

1 个答案:

答案 0 :(得分:1)

试试这个......

query = "CREATE TABLE IF NOT EXISTS "+ table_name+ " name VARCHAR(120), date CHAR(22)"