diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-22 15:19:24 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-22 15:19:24 +0200 |
commit | f4a0bb7dc43ee70e02a66475d3f6c5c52f436262 (patch) | |
tree | 6b02d13b1ab68989df6fd350eed7dfd3266bc68f /Python.wiki | |
parent | ons 15 jun 2022 03:28:03 CEST (diff) | |
download | wiki-public-f4a0bb7dc43ee70e02a66475d3f6c5c52f436262.tar.gz wiki-public-f4a0bb7dc43ee70e02a66475d3f6c5c52f436262.tar.xz |
ons 22 jun 2022 15:19:24 CEST
Diffstat (limited to 'Python.wiki')
-rw-r--r-- | Python.wiki | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Python.wiki b/Python.wiki new file mode 100644 index 0000000..e221599 --- /dev/null +++ b/Python.wiki @@ -0,0 +1,30 @@ + +== Imports are lazy == + +=== main.py === +{{{python +import sys + +match sys.argv: + case [prgr]: + print('Please give a sub-option') + case [prgr, 'a', *args]: + from a import x + print(f'x = {x}') + case [prgr, 'b', *args]: + from b import x + print(f'x = {x}') +}}} + + +=== a.py === +{{{python +print('Importing a') +x = 10 +}}} + +=== b.py === +{{{python +print('Importing b') +x = 20 +}}} |