feat: add none_test.py, subprocess_test.py
This commit is contained in:
10
none_test.py
Normal file
10
none_test.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
b = None
|
||||||
|
print(b, ',', b is None, ',', b is not None, ',', b or False)
|
||||||
|
b = True
|
||||||
|
print(b, ',', b is None, ',', b is not None, ',', b or False)
|
||||||
|
|
||||||
|
s: str = None
|
||||||
|
print(s, ',', s is None, ',', s or "value::test")
|
||||||
13
subprocess_test.py
Executable file
13
subprocess_test.py
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
result = subprocess.run(
|
||||||
|
['curl', 'https://hatter.ink/ip.action'],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
# timeout=30,
|
||||||
|
)
|
||||||
|
print('return code:', result.returncode)
|
||||||
|
print(result.stdout)
|
||||||
Reference in New Issue
Block a user