[Tutor] lists

2006-02-14 Thread Michael Haft
, '10.00', '8.80'] I'm confused because if I try it without the for loop, i.e.: x = 3 p[x] = float(p[x])/10 print p It works just fine, I assume it doesn't like me floating the value but why does it work out of the loop but not in the loop?

[Tutor] list method help

2006-02-02 Thread Michael Haft
loop to pop things from a list? or is there another way to do it? I also tried the following: list = ["1", "test", "1.5"] for x in list: print list.pop(0) which worked but returned the following: 1 test Why did it not return the last value in the li

[Tutor] lists strings and files

2005-11-09 Thread Michael Haft
Hello, thanks for all the help with lists and strings, the list I have has nested sublists in it though. How do I remove these or is there a way to convert from lists to strings without removing them? The code looks something like: result = [] data = [fields[1] fields[3] fields[7]] result.ap

[Tutor] File IO

2005-11-03 Thread Michael Haft
Hello, I tried the following code: def readSOMNETM(inputName): input = open(inputName, "r") result = [] for line in input: fields = line.split() data = fields[1] + fields[2] + fields[7] result.append(data) input.close() return result print "Here g