Python
4
Вклад в тег
from re import findall
open('2.txt', 'w').write('\n'.join([''.join(findall(r"^(\w+?)\s", line)) for line in open('1.txt').read().split('\n') if findall(r"^(\w+?)\s", line)]))
from re import findall
list_=[]
for line in open('1.txt').read().split('\n'):
symbols = findall(r"^(\w+?)\s", line)
list_.append(''.join(symbols)) if symbols else None
open('2.txt', 'w').write('\n'.join(list_))
def Ru_to_En(text):
from random import randint
ru_en = {"у": "y", "е": "e", "х": "x", "а": "a", "о": "o", "с": "c", "р":"p", "К":"K", "М":"M"}
return ''.join([ru_en[letter] if letter in ru_en and randint(0, 1) else ru_en[letter.lower()].upper() if letter.lower() and randint(0, 1) in ru_en else letter for letter in text])
print(Ru_to_En('Какой прекрасный день'))
Kaкoй прекраcный день