#!/usr/bin/env python3
"""
Import a module an use its functions
"""
import mypkg.mymod as M

print(M.countLines('mymod.py'))
print(M.countChars('mymod.py'))
M.test('mymod.py')

# Now try with from
from mymod import *

print('')
print(countLines('mymod.py'))
print(countChars('mymod.py'))
test('mymod.py')

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
Exemple #2
0
import mypkg.mymod as mymod

print(mymod.test('myclient.py'))

from mypkg.mymod import countLines

print(countLines('myclient.py'))
Exemple #3
0
import mypkg.mymod as mymod

mymod.test('/etc/passwd')
print(mymod.countLines('/etc/apt/sources.list'), 
      mymod.countChars('/etc/hosts'), sep='\n')
Exemple #4
0
#!/usr/bin/env python
# Author: Rujie Jiang [email protected]
# Date: Sun Apr  3 23:35:14 2016

"""Client script that imports mymod
"""

from mymod import *

test("myclient.py")
print("After from mymod import *, dir():", dir())
print('-' * 60)

import mypkg.mymod as pkgmod
pkgmod.test("myclient.py")
print("After import mypkg.mymod as pkgmod, dir():", dir())
Exemple #5
0
import mypkg.mymod as mymod
mymod.test()
Exemple #6
0
import mypkg.mymod as mymod

mymod.test()