Home
Sign Up
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 有没有办法,可以在代码中将一段字符串 load 进来作为代码的一部分执行
996635
·
Dec 22, 2016
· 3386 views
This topic created in 3604 days ago, the information mentioned may be changed or developed.
不是 eval,需要包含 context
代码
Python
eval
context
8 replies
•
2016-12-22 21:14:30 +08:00
keenkiller
Dec 22, 2016
1
没看懂 如果是 python 代码,可以用`importlib`之类的方法动态加载吧。。
xFrank
Dec 22, 2016
2
试试 pickle
996635
OP
Dec 22, 2016
3
@
tairan2006
importlib 我试用一下给你反馈, 我的需求就是 http server 接受提交的 code,然后执行后返回结果
@
xFrank
这个是序列化工具吧? 并不能序列化代码
v3exad
Dec 22, 2016
4
exec ...
yongzhong
Dec 22, 2016
5
exec
phrack
Dec 22, 2016 via Android
6
为什么不 Google?
Kilerd
Dec 22, 2016
7
保存到文件, 然后 再 ·python
file.py
· 就好啦。
akira
Dec 22, 2016
8
pypy?
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
1842 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 43ms ·
UTC 16:58
·
PVG 00:58
·
LAX 08:58
·
JFK 11:58
♥ Do have faith in what you're doing.
❯