From 13037ea0bc6f838d69181c8bc049a5982165f666 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Fri, 8 Oct 2021 23:05:25 +0300 Subject: [PATCH] task 061021 update --- task_061021/array_output.txt | 61 +++++++++++++++++++ .../{kacgulis_061021.py => kcgulis_061021.py} | 13 ++-- task_061021/str_output.txt | 0 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 task_061021/array_output.txt rename task_061021/{kacgulis_061021.py => kcgulis_061021.py} (75%) create mode 100644 task_061021/str_output.txt diff --git a/task_061021/array_output.txt b/task_061021/array_output.txt new file mode 100644 index 00000000..ac7aa473 --- /dev/null +++ b/task_061021/array_output.txt @@ -0,0 +1,61 @@ +Line 168 - Chapter 1 +Line 294 - Chapter 2 +Line 404 - Chapter 3 +Line 590 - Chapter 4 +Line 712 - Chapter 5 +Line 832 - Chapter 6 +Line 1120 - Chapter 7 +Line 1369 - Chapter 8 +Line 1634 - Chapter 9 +Line 1850 - Chapter 10 +Line 2147 - Chapter 11 +Line 2345 - Chapter 12 +Line 2421 - Chapter 13 +Line 2616 - Chapter 14 +Line 2747 - Chapter 15 +Line 2926 - Chapter 16 +Line 3315 - Chapter 17 +Line 3454 - Chapter 18 +Line 4023 - Chapter 19 +Line 4227 - Chapter 20 +Line 4424 - Chapter 21 +Line 4651 - Chapter 22 +Line 4840 - Chapter 23 +Line 5029 - Chapter 24 +Line 5247 - Chapter 25 +Line 5415 - Chapter 26 +Line 5663 - Chapter 27 +Line 5818 - Chapter 28 +Line 5980 - Chapter 29 +Line 6264 - Chapter 30 +Line 6398 - Chapter 31 +Line 6584 - Chapter 32 +Line 6765 - Chapter 33 +Line 6993 - Chapter 34 +Line 7230 - Chapter 35 +Line 7524 - Chapter 36 +Line 7733 - Chapter 37 +Line 7889 - Chapter 38 +Line 8013 - Chapter 39 +Line 8193 - Chapter 40 +Line 8393 - Chapter 41 +Line 8666 - Chapter 42 +Line 8865 - Chapter 43 +Line 9412 - Chapter 44 +Line 9652 - Chapter 45 +Line 9843 - Chapter 46 +Line 10157 - Chapter 47 +Line 10619 - Chapter 48 +Line 10872 - Chapter 49 +Line 11150 - Chapter 50 +Line 11387 - Chapter 51 +Line 11617 - Chapter 52 +Line 11960 - Chapter 53 +Line 12305 - Chapter 54 +Line 12504 - Chapter 55 +Line 12792 - Chapter 56 +Line 13145 - Chapter 57 +Line 13337 - Chapter 58 +Line 13622 - Chapter 59 +Line 13907 - Chapter 60 +Line 14093 - Chapter 61 diff --git a/task_061021/kacgulis_061021.py b/task_061021/kcgulis_061021.py similarity index 75% rename from task_061021/kacgulis_061021.py rename to task_061021/kcgulis_061021.py index a891fea8..7d5736e7 100644 --- a/task_061021/kacgulis_061021.py +++ b/task_061021/kcgulis_061021.py @@ -4,8 +4,8 @@ CHAPTERS = 61 -def read_array(): - with open('book.txt', encoding='utf-8') as book: +def read_array(document): + with open(document, encoding='utf-8') as book: lines = [line.strip('\n') for line in book] # removes 'enter' characters with open('array_output.txt', 'w') as output: for i in range(1, CHAPTERS + 1): @@ -13,9 +13,9 @@ def read_array(): output.write(f"Line {line} - Chapter {i}\n") # writes line in file -def read_string(): +def read_string(document): import re - with open('book.txt', encoding='utf-8') as book: + with open(document, encoding='utf-8') as book: lines = book.read() with open('str_output.txt', 'w') as output: for i in range(1, CHAPTERS + 1): @@ -24,8 +24,9 @@ def read_string(): def main(): - read_array() - read_string() + document = input("Ievadiet faila nosaukumu: ") + read_array(document) + read_string(document) if __name__ == '__main__': diff --git a/task_061021/str_output.txt b/task_061021/str_output.txt new file mode 100644 index 00000000..e69de29b