2
文字列をExprに変換する方法はありますか?私は、次のことを試してみましたが、それは動作しません:文字列をevalする/文字列をExprに変換する方法
julia> convert(Expr, "a=2")
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Expr
This may have arisen from a call to the constructor Expr(...),
since type constructors fall back to convert methods.
julia> Expr("a=2")
ERROR: TypeError: Expr: expected Symbol, got String
in Expr(::Any) at ./boot.jl:279
私はしたいと思います 'パース( "A = 2")' –
をありがとう(それは文字列の内容に応じて、Symbol'または '' Expr'に変換されます)。それは私が必要なものです。私はExprの中間でドキュメント(http://docs.julialang.org/en/release-0.5/manual/metaprogramming/)をスキミングしましたが、 '' parse''がトップセクションにあることを確認していませんでした。ページ。 – Phuoc