推荐学习书目
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
qazwsxkevin
V2EX  ›  Python

ExecJS 能不能枚举出对象所有的变量名字? 如不能,当今有何更好的库实现?

  •  
  •   qazwsxkevin · Jan 9, 2024 · 2045 views
    This topic created in 857 days ago, the information mentioned may be changed or developed.

    看 ExecJS 的 Github ,似乎是早已停止支持,目前似乎也还能处理好目标 js 文件,有个问题请教,假定我不知 Object 里有多少个 var ,也不知道变量名称,ExecJS 本身似乎是只能是在假定已知变量名字,才能进行读取,如:

        JSObj = execjs.compile(htmlString)  # 将 js 加载进 execjs 对象
        jsvar_somelist = ['somearr']        # 假如除了 somearr ,还会有其它未知的 var 呢?
    
    2 replies    2024-01-11 17:35:58 +08:00
    hd10180
        1
    hd10180  
       Jan 11, 2024
    Maerd
        2
    Maerd  
       Jan 11, 2024
    execjs 不支持上下文,如果你是要用 node ,一般推荐直接在 node 里起接口通过 rpc 通信,如果你想用 v8js ,一般用 pyminiracer
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5618 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 61ms · UTC 08:22 · PVG 16:22 · LAX 01:22 · JFK 04:22
    ♥ Do have faith in what you're doing.