-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw14.py
More file actions
executable file
·32 lines (23 loc) · 901 Bytes
/
hw14.py
File metadata and controls
executable file
·32 lines (23 loc) · 901 Bytes
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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Savin Ilya Python Homework N14
# ---------------
# Создать сотрудника Mary, пользуясь классом
# Employee и перенести его в другую программу,
# используя модуль Pickle и файловую систему.
# Узнать про + и - модуля Pickle.
# ---------------
import pickle
class Employee:
def __init__(self, name, position, salary):
self.__name = name
self.__position = position
self.__salary = salary
def printinfo(self):
print("====Employee Info====")
print("Name: ", self.__name)
print("Position: ", self.__position)
print("Salary: ", self.__salary)
Mary = Employee("Mary Doe", "Technician Director", 100000)
with open('pickle_exchange.pkl', 'wb') as outfile:
pickle.dump(Mary, outfile)