Created
January 28, 2018 01:04
-
-
Save Fhernd/094274844fab21eceb85ce5e63bf5f64 to your computer and use it in GitHub Desktop.
Guardar objeto en disco en Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
class Computador: | |
def __init__(self, marca): | |
self.marca = marca | |
def encender(self): | |
pass | |
def apagar(self): | |
pass | |
def obtener_marca(self): | |
return self.marca | |
archivo = open('computador.pickle', 'wb') | |
laptop = Computador('Asus') | |
pickle.dump(laptop, archivo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment