Home
Sign Up
Sign In
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
Python 内置函数 compile 用法
guanganqishi
·
Feb 3, 2018
· 4698 views
This topic created in 3017 days ago, the information mentioned may be changed or developed.
现在有一个文件 xx.py 里有个代码 print('hello python'),在 test.py 中怎么用内置函数 compile 执行它
compile
函数
print
Python
3 replies
•
2018-02-05 16:50:10 +08:00
1
KKKKKK
Feb 3, 2018 via Android
Eval(open(
xx.py
).Read())
2
fakepoet
Feb 4, 2018
with open('
xx.py
', 'r') as f:
obj = compile(f.read(), '', 'exec')
exec(obj)
3
Ctry
Feb 5, 2018
import xx
e = compile('', '
xx.py
', 'exec')
exec(e)
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
2861 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 44ms ·
UTC 02:01
·
PVG 10:01
·
LAX 19:01
·
JFK 22:01
♥ Do have faith in what you're doing.
❯