Write in a txt file in PYTHON with class name which varie (0 to N) : I have a class name myClass which contain some attributes (attribute0, attibute1...).

I have create N myClass (myClass0, myClass1...).

To write in a .txt file myClass0.attribute0:

    fichier = open("myFile.txt", "a")
    fichier.write("{}".format(myClass0.attribute0))

I want to write in the file myFile.txt myClassN.attribute0 with N for 0 to 9:

    fichier = open("myFile.txt", "a")
    fichier.write("{}".format(myClass0.attribute0))
    fichier.write("{}".format(myClass1.attribute0))
    .
    .
    .
    fichier.write("{}".format(myClass9.attribute0))

How to do it in a loop ?

Thanks a lot.