Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created January 28, 2018 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/094274844fab21eceb85ce5e63bf5f64 to your computer and use it in GitHub Desktop.
Save Fhernd/094274844fab21eceb85ce5e63bf5f64 to your computer and use it in GitHub Desktop.
Guardar objeto en disco en Python.
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