Can we insert a code of python for example to do some work in html file for example ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we insert a code of python for example to do some work in html file for example ?

Can we mix many programming languages in one file? And how we can do this??

14th Dec 2018, 8:46 AM
Ahmad Ali
Ahmad Ali - avatar
4 Answers
+ 3
Since Python, C family, node.js are server-side programming languages so you can't pass server-side code to work in client-side, instead they created new languages allows you to render the web content e.g. ejs is javascript framework used at rendering web content for the client, dynamical, another example razor uses c# or VB and html5 To create active server pages I hope that's helped..
14th Dec 2018, 9:05 AM
Ahlin Chan
Ahlin Chan - avatar
+ 2
if you only want to run something like a python file, you can do it with php for example with exec("python [path_to_file/file.py]"); Or other programming languages with cmd commands But it's not a performant way.
14th Dec 2018, 9:10 AM
Max_N
Max_N - avatar
+ 1
Its possible btw https://www.sololearn.com/discuss/1613382/?ref=app there are brython for py3 and skuplt for py2 to use python in browser.
14th Dec 2018, 10:18 AM
Taste
Taste - avatar
- 1
You cant use python on a Web site Since Python is OOP based program language but try to use something web based such as Js(JavaScript)
14th Dec 2018, 8:50 AM
Vanessa Nilsson