import re
pattern = re.compile(r"(^[^-]*-[^-]*)-[^-,]*")
with open('out.csv', encoding='utf-8') as f:
for row in f.readlines():
m = pattern.match(row)
if m:
print(m.group(1))
out.csv
https://www.abcde.com/-0w69e7e1w00-AIUEO
https://www.abcde.com/-0w69e7e9w70-Kakikukeko
https://www.abcde.com/-0w08e1e0w00-SA Shi Su Se So
https://www.abcde.com/-0w69e7e1w70-TA Chi Tsu Te à
https://www.abcde.com/-0w69e6e2w54-Qu'Est-ce que c'est
Recommended Posts