task 061021 update

This commit is contained in:
Kristofers Solo 2021-10-08 23:05:25 +03:00
parent 94d7d99f27
commit 13037ea0bc
3 changed files with 68 additions and 6 deletions

View File

@ -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

View File

@ -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__':

View File