How does one print the lines of code?
Suppose we have here two variables.
var1 = 2*8
msg = "Answer is: "
What statement should i add here so that this program will print the source code?
How does one print the lines of code?
Suppose we have here two variables.
var1 = 2*8
msg = "Answer is: "
What statement should i add here so that this program will print the source code?
The easiest way to print the lines of codes is through the use of the built-in functions.
print open(__file__).read()
Or you could just write the code in string mode and simply print them. However that obviously won't be executable codes anymore once written in quotation marks.