Skip to content

Commit 9b47a4a

Browse files
committed
Add some examples about standard library.
1 parent 0f26e9e commit 9b47a4a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

standard_lib/math_module/main.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# math module example
2+
3+
import math
4+
print(f'pi = {math.pi}')
5+
print(f'cos(pi / 4) = {math.cos(math.pi / 4)}')

standard_lib/os_module/main.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import os
2+
print(os.getcwd()) # current working directory
3+
os.system('echo hello') # execute given command in a subshell.

standard_lib/sys_module/main.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enter '$ python main.py foo bar'to execute this example script.
2+
# ['main.py', 'foo', 'bar'] should be outputed.
3+
import sys
4+
print(sys.argv)

0 commit comments

Comments
 (0)