This note is updated frequently without notice!
;is not used, use spaces instead!
- If you wanna 2 or more commands in 1 line, you can use
;to separate them.
- Tab size usually is 4.
- Lines can be broken with just an Enter, you also use
\between the lines if you want.
- From Python 3.6, you can use
1_000_000for the number
from __future__ import <package>allows current version of python to use
<package>which is only available in the “future” version of python.
if __name__ == "__main__":determines the main running file of codes. The codes inside this command only run if the file containing it is the main executed file![read more]
If we don’t need to mention some variable, use
for _ in range(2): print("Thi")
- Clear (without confirmation) a variable from workspace:
- Clear all variables:
%reset(with confirmation) and
%reset -f(without confirmation).
# on each line.
# print("This is not showed.") print("This is showed.)
This is showed.
If you wanna make a docstring (showing the information of a function when using
def reverse(text): """Reverse a text. Input the text. Return text reversed. """ return text[::-1] help(reverse)
reverse(text) Reverse a text. Input the text. Return text reversed.