Ebic python tutorial: Javascript in python :0
h
angrydoge (334)

Welcome

I'm gonna show you how to use the "os" module to use javascript in python in multiple steps!

  1. Create a Javascript file with code in it
    For me its gonna be "file.js"

  2. import the "os" module

import os
  1. add a "os.system()" function.
os.system()
  1. Add "node <filename>"
    As I said earlier, my filename is "file.js" so I add this
os.system("node file.js")
  1. Watch it run your javascript!

Note:

alert() and other functions focused toward HTML may not work because this is python for goodness sake

You are viewing a single comment. View All