-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.py
More file actions
37 lines (29 loc) · 883 Bytes
/
Copy pathshell.py
File metadata and controls
37 lines (29 loc) · 883 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
import os
def parsepattern(pattern:str ,r): #example cl$r%(v1).py:v1=$R*0.11+0.86
pattern=pattern.replace("$R",r)
pdb=pattern.split(":")
vs={}
vl=[]
for i in pdb[1:]:
idb = i.split("=")
vl.append(idb[0])
vs[idb[0]]=eval(idb[1])
print(vs)
ptr=pdb[0]
for i in vl:
ptr=ptr.replace(f"%({i})",str(vs[i]))
return ptr
while True:
x=input(">>")
if x=="exit":
break
elif x=="cl":
os.system("clear")
elif x=="r":
r=int(input("no of time to repeat"))
P=input("pattern")
b=input("path of source")
l= input("lang")
for i in range(r):
#os.system(f"./codebuilder.exe {l} {b} output/{parsepattern(P,i)}")
print(f"./codebuilder.exe {l} {b} output/{parsepattern(P,str(i))}")