How to Use Echo in Python
Unlike PHP, the Python programming language does not have an "echo" function that produces a string of output information. Instead, Python uses another similar statement called "print" to produce the same effect. The Python print function evaluates each entered string expression in turn and relays it in simplified form. If the entered information contained within the print expression is not considered a string, it converts automatically to a string before output.
Open a python evaluator or code editor.
Create a variable with which to define your string --- for example, x = 'Hello' where "x" is the variable and "Hello" is your string. String values include items such as text, numerical content and expressions.
Type the word "print" with a trailing left parenthesis after creating the variable.
Type the variable you created after the starting parenthesis.
Close the print function with a right parenthesis. You should have something like print(x) with "x" representing your variable.
Enter this print function; the string you entered to represent the variable should be the output return you receive.
Tips & Warnings
- If you are using a CGI based output from your Python code, the print function works almost exactly like the PHP echo function. You do not have to define a variable for each string input in this scenario.