-
Notifications
You must be signed in to change notification settings - Fork 0
/
dikt.py
63 lines (52 loc) · 1.09 KB
/
dikt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
#coding=utf-8
from itertools import *
import random
import sys
def read_file(name):
with open(name) as f:
return [word for line in f for word in line.split()]
parts = [
[
read_file("1.txt"),
read_file("2.txt"),
read_file("3.txt"),
],
[
read_file("4.txt"),
read_file("5.txt"),
read_file("6.txt"),
],
[
read_file("7.txt"),
read_file("8.txt"),
read_file("9.txt"),
]
]
def shuffle():
#random.shuffle(parts)
for component in parts:
for l in component:
random.shuffle(l)
poems = []
indexed_words = []
word_count = 0
part_index = []
line_indexes = {}
line_index = 0
limit = 335
current = 0
while current < limit:
current += 1
shuffle()
words = []
for part in parts:
for line in part:
for word in line:
words.append(word)
break
for i, word in enumerate(words):
if i % 3 == 0:
sys.stdout.write("\n")
sys.stdout.write(word + " ")
sys.stdin.readline()