Add last value

This commit is contained in:
Jose De Freitas 2021-02-19 11:04:53 -05:00
parent 1c7d153a28
commit 256d6e72a0

View File

@ -11,24 +11,28 @@ def content_about():
Looks for trailing slashes and words separated by commas at
every "Content about:" section found in the readme.md file
(this is, the list itself).
result (str): return value of the function.
checker (str): detector of the line corresponding the file.
"""
content_about_result = 'No errors found.'
# content_about_errors = {}
content_about_line = 'Content about:'
result = 'No errors found.'
checker = 'Content about:'
for j, i in enumerate(content_readme):
if content_about_line in i:
# content_about_words = i[len(content_about_line):-2]
if i[-2] != '\\':
content_readme[j] = i.replace('&', '\\')
for line, value in enumerate(content_readme):
if checker in value:
# words = i[len(checker):-2].split(', ')
# Check for trailing slash
if value[-1] != '\\':
last = value[-2:-1]
replaced = last.replace(' ', '\\', 1)
content_readme[line] = value[:-2] + ' ' + replaced + '\n'
with open(file_readme, 'w') as write_readme:
write_readme.writelines(content_readme)
content_about_result = "Found errors. Fixed them."
# content_about_errors.append(j)
return content_about_result
# return content_about_errors
result = "Found errors. Fixed them."
# Check for comma separated words
return result
print(content_about())