11 lines
358 B
Python
11 lines
358 B
Python
import re
|
|
|
|
def process_file(file_path):
|
|
with open(file_path, 'r',encoding='utf-8') as file:
|
|
for line in file:
|
|
modified_line = re.sub(r'\b(?:[A-Z]+\w*[a-z]+\w*|[a-z]+\w*[A-Z]+\w*)\b', lambda match: match.group(0).swapcase(), line)
|
|
print(modified_line, end='')
|
|
|
|
file_path = 'polish_wiki_excerpt.exp'
|
|
process_file(file_path)
|