ArmanPython
6 subscribers
2 photos
28 files
10 links
Transfer python files
Download Telegram
Մի տողը չի թողնում թ սարքել
import os
import re
change_list = ("merge_series(", "merge_parallel(")
myfile = open("cmos12lpplus.compare.rs", "r")

tmp_str = ""
out = ""
found = False
count = 0
com = ""

for line in myfile.readlines():

pattern = re.compile(r"(^[\t\s]*//)") #exclude // average_merge_method","perim"}
comments = pattern.finditer(line)

for match in comments:
com = match.group(1)

if any(token in line for token in change_list):
found = True
tmp_str = ""
count = 0
while line[count] == "\t":
count += 1
r1 = "});"
if found and r1 in line:
found = False
tmp_str = ""

if found and not line.startswith(com):
tmp_str += line
out += "//" + line

if found and " );" in line:
found = False

tmp_str = tmp_str.replace("\n","")
tmp_str = tmp_str.replace(" ","")
tmp_str = tmp_str.replace("\t","")
tmp_str = "\n" + "\t" * count + tmp_str + "\n"
tmp_str = re.sub('[\t\s]*/\*.*\*/', "", tmp_str) #exclude tolerance line 1683/1715
tmp_str = re.sub("^[\t\s]*\/\*", "\t", tmp_str) #exclude c++ comments
tmp_str = re.sub("\*\/", "", tmp_str) #exclude c++ comments

out += tmp_str
continue

if not found:
out += line
outfile= open("cmos12lpplus.compare.rs_int.rs", "w")
outfile.write(out)
if found and r1 in line:
found = False
out+= line
continue
Նայես գրի
def starts_with(text, start):

k = len(start)
p = text[:k]
if p == start:
print("the sring starts with -- {}".format(start))
else:
print("Error --> String did not start with -- {}".format(start))

text = "Adfkadjgjaofkgjoafijhodnhhjkhjskghbjsklgjslkfjagkjrman"
start = "Adfkadjgjaofkgjvo"
starts_with(text, start)
en asacs funkcian gri vor 2 string tam ases erkrord@ arajini mej parunakvuma te che
(.SUBCKT\s|.subckt\s)(.*)\s.\W.+
lucecir?
This media is not supported in your browser
VIEW IN TELEGRAM
es vhati anun@ poxi eli urish chateri hetem xarnum