Jezyki_formalne_cw/5/format_cars.py

10 lines
318 B
Python
Raw Permalink Normal View History

2023-07-04 19:57:29 +02:00
with open("tresc_zadan/marki-samochodów.txt","r") as car_brands:
regex = "(?<="
for brand in car_brands:
regex += brand.removesuffix("\n") + " |"
# regex[len(regex)-1] = ")"
# print(regex[:len(regex)-1])
regex = regex.removesuffix("|") + ")"
regex += "[A-Z][a-z\s\-A-Z]*"
print(regex)