Enhance sorting functionality in asort.py (#772)

This commit is contained in:
KhwajaYousuf 2024-01-13 01:19:20 -05:00 committed by GitHub
parent e5b311dff3
commit 847365f7ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -5,8 +5,8 @@
# GitHub: https://www.github.com/chrisleegit
# File: asort.py
# Date: 2016/08/22 11:12
# Version: 0.1
# Description: A very simple python script that can sort items alphabetically.
# Version: 0.2
# Description: A python script to sort items alphabetically.
import os
import shutil
@ -37,7 +37,7 @@ def main():
print(f'Cargando archivo: {README_FILE}')
# Read the file: README.md
with (open(README_FILE, 'r') as infile, open(TEMP_FILE, 'w') as outfile):
with open(README_FILE, 'r') as infile, open(TEMP_FILE, 'w') as outfile:
# Process each line
for line in infile:
if not sort_enable and BEGIN in line:
@ -65,9 +65,9 @@ def main():
print(line, end='', file=outfile)
else:
print(line, end='', file=outfile)
print('Reemplazar el archivo original: README_es-ES.md')
shutil.move(TEMP_FILE, README_FILE)
if __name__ == '__main__':
main()