Print: Difference between revisions
From Jedisaber Wiki
Created page with "Print prints stuff to the screen. [code]print("Print this.")[/code] Will print: Print this." |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Print prints stuff to the screen. | Print prints stuff to the screen. | ||
=== Basic Print stuff: === | |||
<code>print("Print this.")</code> | |||
Will print: | |||
<pre>Print this.</pre> | |||
You can also print variables: | |||
<code>_textcon = "This is the text to print."</code> <br /> | |||
<code>print(_textcon)</code> | |||
f strings<br /> | |||
F strings are one way to print a bunch of stuff with one line of code: | |||
<code>print(f"Hello, {_textcon}! \n How are you?")</code> | |||
Will print: | Will print: | ||
<pre> | |||
Hello, This is the text to print. | |||
How are you? | |||
</pre> | |||
=== Escape Characters === | |||
In python, escape with a backslash \ | |||
Escape Sequence - Character | |||
\\ Backslash <br /> | |||
\b Backspace <br /> | |||
\t Tab <br /> | |||
\r Carriage Return (CR) <br /> | |||
\n Line Feed (LF) <br /> | |||
=== References === | |||
https://realpython.com/python-print/?utm_source=notification_summary&utm_medium=email&utm_campaign=2025-06-26 | |||
Latest revision as of 00:31, 27 June 2025
Print prints stuff to the screen.
Basic Print stuff:
print("Print this.")
Will print:
Print this.
You can also print variables:
_textcon = "This is the text to print."
print(_textcon)
f strings
F strings are one way to print a bunch of stuff with one line of code:
print(f"Hello, {_textcon}! \n How are you?")
Will print:
Hello, This is the text to print. How are you?
Escape Characters
In python, escape with a backslash \
Escape Sequence - Character
\\ Backslash
\b Backspace
\t Tab
\r Carriage Return (CR)
\n Line Feed (LF)
