如何在不使用py文件的情况下将字符串转换为pyc文件?
How to convert a string into a pyc file without using a py file?
我有一个字符串 print("hello")
。我想直接将其存储为.pyc 文件,稍后再执行。我该怎么做?
看看 py_compile.compile and its source code 了解它是如何完成的。
我有一个字符串 print("hello")
。我想直接将其存储为.pyc 文件,稍后再执行。我该怎么做?
看看 py_compile.compile and its source code 了解它是如何完成的。