-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule_test.py
More file actions
49 lines (34 loc) · 719 Bytes
/
Copy pathmodule_test.py
File metadata and controls
49 lines (34 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
from module1 import foo
from module2 import foo2
# from ex import PI, get_sum
' a test module '
__author__ = 'Michael Liao'
print(foo())
print(foo2())
# print(PI)
# print(get_sum([1, 2, 3, 4, 5]))
# os.remove('ex.py')
with open('ex.py', 'w') as f:
f.write("""
PI = 3.14
def get_sum(lst):
total = 0
for v in lst:
total = total + v
return total
""")
def test():
args = sys.argv
if len(args) == 1:
print('Hello World')
elif len(args) == 2:
print('Hello, %s!' % args[1])
else:
print('Too many arguments!')
print('__name__', __name__)
if __name__ == '__main__':
test()