哪個 Python 模組可以混淆 javascript?


你可以使用 jsmin 模組來使用 Python 最小化/混淆 javascript 程式碼。使用以下語法安裝 jsmin

$ pip install jsmin

要在你的 python 專案中使用 jsmin 來最小化一個 js 檔案(比如 hello.js),你可以這樣使用

>>> from jsmin import jsmin
>>> with open('hello.js') as js_file:
...     minified = jsmin(js_file.read())
>>> print minified

你會看到最小化的 JS 程式碼列印到你的 shell 上。你也可以把 jsmin 作為命令列工具

$ python -m jsmin hello.js

你可以在 pypi 文件中閱讀更多關於 jsmin 的資訊:https://pypi.python.org/pypi/jsmin

更新時間: 2019-09-12

905 次瀏覽

開啟你的 事業

完成課程認證

立即開始
廣告
© . All rights reserved.