@acwoss/

ProfuseSafeBuffalo

Python 2.7

No description

fork
loading
Files
  • main.py
main.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
from itertools import chain

def insert_file(filename):
    with open(filename, "w") as file:
        matrix = []
        for i in range(2):
            row = []
            for j in range(2):
                row.append(raw_input())
            matrix.append(row)
        file.write("\n".join(chain(*matrix)))
        
def read_file(filename):
    with open(filename, "r") as file:
        matrix = []
        for i in range(2):
            row = []
            for j in range(2):
                row.append(int(file.readline().strip()))
            matrix.append(row)
    return matrix
        
insert_file("data.txt")
data = read_file("data.txt")

print(data)