比如說現在有這么一段字符串,"print('helloworld')",那么怎么將其轉換成python認識的格式運行?
s="print('helloworld')" r = compile(s,"<string>", "exec") exec(r)
輸出:helloworld
比如說現在有這么一段字符串,"print('helloworld')",那么怎么將其轉換成python認識的格式運行?
s="print('helloworld')" r = compile(s,"<string>", "exec") exec(r)
輸出:helloworld
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。