Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のようなコマンドがあります。
test = ('print( "It works!" )' )
その文字列内にあるコマンドを使用したい。抽出して使用する方法を知っていますか?
どうもありがとう、レムス
使用しますexecが、コードを信頼していることを確認してください。セキュリティ上の理由から、ユーザーが提出したコードに対してこれを実行しないでください
exec
>>> test = ('print( "It works!" )' ) >>> exec test It works!