-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImportLib.py
40 lines (29 loc) · 835 Bytes
/
ImportLib.py
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
import os
DIR_PATH = os.path.dirname(os.path.abspath(__file__)) + "/Dell"
def LoadModule(absPath):
title, ext = os.path.splitext(os.path.basename(absPath))
file = open(absPath, "r")
data = file.read()
file.close()
file = open(title + "__TEMP.py", "w")
file.write(data)
file.close()
module = __import__(title + "__TEMP")
os.remove(DIR_PATH + title + "__TEMP.py")
return module
def search(value, string):
result = []
curr = ""
index = 0
for i in range(0, len(string)):
curr += string[i]
if value == curr:
result.append(i - len(value) + 1)
index = 0
curr = ""
elif value[index] == string[i]:
index += 1
else:
index = 0
curr = ""
return result