Getting Variables from a file
petersc at stud.ntnu.no
Sat May 27 21:31:10 EDT 2000
I would be careful about using this new string attributes.
After all not everyone has 1.6a2 installed.
for line in string.split(vars,"\n"):
k,v = string.split(line," = ")
# does not protect you from evil code
# but may show some mistakes
print "warning: not an assignment '"+line+"'"
emile at fenx.com wrote:
> This should get you started:
> for line in vars.split("\n"):
> k,v = line.split(" = ")
> exec (line)
> # doexn't parse out as tuple w/ interspersed =
Peter Schneider-Kamp ++47-7388-7331
Herman Krags veg 51-11 mailto:peter at schneider-kamp.de
N-7050 Trondheim http://schneider-kamp.de
More information about the Python-list