форкнуто от main/python-labs
Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
20 строки
555 B
Python
20 строки
555 B
Python
from random import randint
|
|
from pickle import dump, load
|
|
from os import chdir
|
|
|
|
chdir('/Users/vatarishin/lab_sem_5/python-labs/TEMA6')
|
|
intTuple = ()
|
|
|
|
for _ in range(125): intTuple + (str(randint(6, 56)), )
|
|
|
|
surnames = ['Kovalenko', 'Hoduyk', 'Ivanov', 'Mahnov']
|
|
|
|
with open('bin_task.bin', mode='wb') as file:
|
|
dump(intTuple, file)
|
|
dump(surnames, file)
|
|
|
|
with open('bin_task.bin', mode='rb') as file:
|
|
binObj1 = load(file)
|
|
binObj2 = load(file)
|
|
|
|
print(f'tuples are indentical: {binObj1 == intTuple}\nlists are indentical: {surnames == binObj2}') |