Created
August 28, 2016 08:19
-
-
Save vfrico/cb82b3dbe0a639d2022d82beb20473a1 to your computer and use it in GitHub Desktop.
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
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Puede que haya alguna forma más correcta en python para poner atributos solos en la clase, pero esta funciona bastante bien