[Tutor] Using 'join ' function to create a string

2007-12-21 Thread lechtlr
Hi there, I would like to know what is the best way to create a string object from two different lists using 'join' function. For example, I have X = ['a', 'b', 'c', 'd', 'e'] and Y = [1, 2, 3, 4, 5]. From X and Y, I want to create a string Z = 'a:1, b:2, c:3, d:4, e:5'. Any help would greatly

[Tutor] Reading Input Data

2008-01-15 Thread lechtlr
I want to read an input file (file.csv) that has two columns. I want to read 2nd column and assign variables that are strings and floats. Currently, I use the following split() function to read from the input file and create a list, and then assign each element to a variable. I am wondering th

Re: [Tutor] Reading Input Data

2008-01-16 Thread lechtlr
l Langford wrote: > > for subscript,line in enumerate(file("file.csv")): > > s = line.split(",")[1] > > try: > > f = float(s) > > locals()["x%i" % subscript]=f > > except: > > lo