same directory
import
print('import my_modeule...')
test = 'Test String'
def find_index(to_search, target):
'''Find the index of a value in a sequence'''
for i, value in enumerate(to_search):
if value == target:
return i
return -1
import python_tutorial
courses = ['History', 'Math', 'Physics', 'Compsci']
index = python_tutorial.find_index(courses, 'Math')
print(index)
'''
out:
import my_modeule...
1
[Finished in 93ms]
'''
import ... as ...
import python_tutorial as pt
courses = ['History', 'Math', 'Physics', 'Compsci']
index = pt.find_index(courses, 'Math')
print(index)
from ... import ... (as ...)
from python_tutorial import find_index
courses = ['History', 'Math', 'Physics', 'Compsci']
index = find_index(courses, 'Math')
print(index)
from python_tutorial import find_index, test
courses = ['History', 'Math', 'Physics', 'Compsci']
index = find_index(courses, 'Math')
print(index)
print(test)
'''
out:
import my_modeule...
1
Test String
[Finished in 67ms]
'''
from ... import *
from python_tutorial import *
courses = ['History', 'Math', 'Physics', 'Compsci']
index = find_index(courses, 'Math')
print(index)
print(test)
'''
out:
import my_modeule...
1
Test String
[Finished in 76ms]
'''
Different directory