0

Hello,
I have a code which generates QR codes from a csv file:

#Importar base de dades
pathFile = ('E:\Usuarios\Daniel\Documents\APNAE\QR\Llistat_socis_alta.csv')
socisAPNAE = pd.read_csv(pathFile, delimiter = ';', encoding='ISO-8859-1')

#generar codi QR
for i in range(0,len(socisAPNAE.index)):    
    soci = socisAPNAE.iloc[i,1:6]
    nom = socisAPNAE.iloc[i,1]
    nom = nom.encode('latin-1')
    qr = QRCode(version=20, error_correction=ERROR_CORRECT_L)
    qr.add_data(soci)
    qr.make()
    im = qr.make_image()
    im.save('E:/Usuarios/Daniel/Documents/APNAE/QR/test.jpeg')

I would like to know how can I force the loop to rename the output file (test.jpeg, it is overwritten everytime the loop starts) with the string contained in the variable "nom". Can you help? Also, if you find a way to make the code nicer I'll be glad that you explain it to me. I'm just a beginer!
Thank you so much,

Dani

3
Contributors
3
Replies
28
Views
3 Years
Discussion Span
Last Post by acrocephalus
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.