[Tutor] importing into fields

Daniel Ehrenberg littledanehren at yahoo.com
Mon Jan 5 19:06:47 EST 2004


> But back to your problem.
> 
> I assume you have a relatively current version of
> Python so your code
> can be written a bit simpler and IMO easier to read.
> 
> f=open ("book2.txt")
> for line in f:
>   print line
>   L = line.split(",", 11)
>   PlayIt.SetFieldContent ("SY012M1", "art-nr", L[0])
>   PlayIt.PlayContent ("{CSB SY012M1|art-nr}{Enter}")
>   PlayIt.SetFieldContent ("SY012ADM1", "001bez", 
> L[1])
>   PlayIt.SetFieldContent ("SY012ADM1", "005agr", 
> L[2])
>   PlayIt.SetFieldContent ("SY012ADM1", "006agr", 
> L[3])
>   PlayIt.SetFieldContent ("SY012ADM1", "009kst", 
> L[4])
>   PlayIt.SetFieldContent ("SY012EHM1", "005laeh",
> L[5])
>   PlayIt.SetFieldContent ("SY012EHM1", "006lauf",
> L[6])
>   PlayIt.SetFieldContent ("SY012EHM1", "011vkuf",
> L[7])
>   PlayIt.SetFieldContent ("SY012SDM1", "012fest",
> L[8])
>   PlayIt.SetFieldContent ("SY012PRM1", "001tpr", 
> L[9])
>   PlayIt.SetFieldContent ("SY012PRM1", "002wpr", 
> L[10])
>   PlayIt.SetFieldContent ("SY012PRM1", "003plpr",
> L[11])
>   PlayIt.PlayContent ("{CSB SY012M1|art-nr}{F2}")
> 
> f.close()
> 
> (I replaced your l with L since IMO a single
> smallcaps l is hard to
> distinguish from a 1.)
> 
> 
> 
>    Karl

Are you sure that would have the same functionality?
His program stopped at any empty string, not just the
end of the file. I'm not sure if this was the desired
behavior, though.

Daniel Ehrenberg

__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003



More information about the Tutor mailing list