додав скрипт форматування таблиць для лаб №2 #23

Merged
hasslesstech merged 4 commits from shmuliar-table-converter into master 2024-03-24 17:14:12 +02:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 06b52b1efc - Show all commits

View File

@ -96,7 +96,7 @@ if __name__=="__main__":
if len(files) == 1: if len(files) == 1:
name = files[0] name = files[0]
data = open(name).read() data = open(name, encoding = "utf-8").read()
if usecase_formatting == YES: if usecase_formatting == YES:
if verbose == YES: if verbose == YES:
@ -113,14 +113,14 @@ if __name__=="__main__":
print(formatted_table_data) print(formatted_table_data)
if write_to_file > AUTO: if write_to_file > AUTO:
open(name + ".table", 'w').write(data+"\n") open(name + ".table", 'w', encoding = "utf-8").write(data+"\n")
exit(0) exit(0)
for no, name in enumerate(sys.argv[1:]): for no, name in enumerate(sys.argv[1:]):
print(f"Converting {no+1}/{len(sys.argv)}") print(f"Converting {no+1}/{len(sys.argv)}")
data = open(name).read() data = open(name, encoding = "utf-8").read()
if usecase_formatting == YES: if usecase_formatting == YES:
if verbose >= AUTO: if verbose >= AUTO:
@ -137,4 +137,4 @@ if __name__=="__main__":
print(formatted_table_data) print(formatted_table_data)
if write_to_file >= AUTO: if write_to_file >= AUTO:
open(name + ".table", 'w').write(data+"\n") open(name + ".table", 'w', encoding = "utf-8").write(data+"\n")