mirror of
https://github.com/JoseDeFreitas/awesome-youtubers.git
synced 2024-12-22 21:59:25 -05:00
37 lines
994 B
Python
37 lines
994 B
Python
import pathlib
|
|
|
|
here = pathlib.Path(__file__).parent
|
|
file_readme = here / '../../readme.md'
|
|
with open(file_readme, 'r') as read_readme:
|
|
content = read_readme.readlines()
|
|
|
|
CHECKER = "Content about:"
|
|
|
|
|
|
def trailing_slash() -> str:
|
|
"""
|
|
Looks for backslash and the end of all the matching
|
|
lines ("Content about:" lines).
|
|
"""
|
|
|
|
result = ["🟢 0: perfect."]
|
|
|
|
for line, value in enumerate(content):
|
|
if CHECKER in value:
|
|
last = value[-2]
|
|
if last != "\\":
|
|
if last == " ":
|
|
content[line] = f"{value[:-1]}\\\n"
|
|
else:
|
|
content[line] = f"{value[:-1]} \\\n"
|
|
|
|
with open(file_readme, 'w') as write_readme:
|
|
write_readme.writelines(content)
|
|
|
|
result.append(f"🔴 {line}: backslash. Fixed.")
|
|
|
|
if len(result) > 1:
|
|
return '\n'.join(result[1:])
|
|
else:
|
|
return ''.join(result)
|