file f:\\pulldpto.ini hold following data...
101;Activaciones;Virginia Aláez;C/ Isabel Colbrand, 22 , Edif D Planta 4º ;28050 ( Madrid)

what will be out put of variables.

[python]
fINI='f:\\pulldpto.ini'
fINI=open(fINI,'r')
while 1:
linea=fINI.readline()
if not linea:break
linea=string.split(linea,';')
variabl1[string.strip(linea[0])]=0
variable2[string.strip(linea[0])]=string.strip(linea[1])
fINI.close()
[/python]

Recommended Answers

All 5 Replies

Member Avatar for leegeorg07

what is the code for the file?

what is the code for the file?

this is a python code and yes it use file.

Member Avatar for leegeorg07

can you show it to us please?

What exactly do you need explained? Also, in stead of [python] you should be using code tags. To get language-specific syntax highlighting use it like this:
[code=python] # Code in here

[/code]

Two or three print statements should do the trick. Note that string is no longer used. It should be linea=linea.split(';') instead of linea=string.split(linea,';'), etc.

fINI='f:\\pulldpto.ini'
fINI=open(fINI,'r')
while 1:
   linea=fINI.readline()
   if not linea:break
   linea=string.split(linea,';') 
   print "linea after split =", linea
   print "     setting", variabl1[string.strip(linea[0])], "to zero"
   variabl1[string.strip(linea[0])]=0
   print "     setting", variable3[string.strip(linea[0])], "to", string.strip(linea[1])
      variable2[string.strip(linea[0])]=string.strip(linea[1])
fINI.close()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.