def get(data):
if "&" not in data or "#" not in data:
return
k, v = data.split("#")
if " " not in v:
res = {k.strip():v.strip()}
elif "-YIN T0BCI NEREIDUL" in v:
res = {k.strip():v[:v.find("-YIN T0BCI NEREIDUL")].strip()}
elif "-GI LABLAJV UJE" in v:
res = {k.strip():v[:v.find("-GI LABLAJV UJE")].strip()}
elif "-UN HUNDUDHEL" in v:
res = {k.strip():v[:v.find("-UN HUNDUDHEL")].strip()}
elif "UGEI" in v:
res = {k.strip():v[v.find("UGEI")+4:].strip()}
elif "BVSV" in v:
res = {k.strip():v[v.find("BVSV")+4:].strip()}
else:
return
return res
if __name__ == "__main__":
text = """AAA#BBB.
CCC#DDDD.
CINGGIS&HAGAN:Yn#GAR-VN&USUG:Yn.
SINJI&CINAR:Yn#AGVLA-YIN&0R0I:Yn-YIN T0BCI NEREIDUL.
OL&H0G0LA:Yn#EMEGE&EJI:Yn-GI LABLAJV UJE.
BVSIGV&TURGEN:Yn#CAGAN&IDEGE:Yn-UN HUNDUDHEL.
LABDAGVN&T0GTAGVN:Ya#CAGAN UGEI GALTV&AGVLA:Yn.
G0Y0&SAYIHAN:Ya#JUI BVSV NEYIGEM&JIRVMTV:Ya."""
for i in text.splitlines():
if get(i):
print(get(i))
|