Jezyki_formalne_cw/5/format_cars.py
2023-07-04 19:57:29 +02:00

10 lines
318 B
Python

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)