Skip to content

Instantly share code, notes, and snippets.

@vfrico
Created August 28, 2016 08:19
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 vfrico/cb82b3dbe0a639d2022d82beb20473a1 to your computer and use it in GitHub Desktop.
Save vfrico/cb82b3dbe0a639d2022d82beb20473a1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
class UnaClase():
def __init__(self):
self.atributo1 = 1
self.atributo2 = 2
lista = []
for i in range(0,10):
uc = UnaClase()
uc.atributo1 = "modificado: "+str(i)
lista.append(uc)
for i in lista:
print(i.atributo1)
@vfrico
Copy link
Author

vfrico commented Aug 28, 2016

Puede que haya alguna forma más correcta en python para poner atributos solos en la clase, pero esta funciona bastante bien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment