Anyone know the solution

Dave Angel davea at davea.name
Wed Oct 29 03:11:26 CET 2014


Cameron Simpson <cs at zip.com.au> Wrote in message:
> On 28Oct2014 09:07, ngangsia akumbo <ngangsia at gmail.com> wrote:
>>This is a sample code on how to read data from a file
>>
>>files1 {}
>>
>>result = open("file1.txt")
>>for line in result:
>>    file1 = line>split()
>>files1.append(file1)
>>result.close()
>>file1.sort()
>>file1.reverse()
>>
>>print('THE FILE INFO')
>>
>>print(file1(0)
>>print(file1(1)
> 
> Do you have a specific question to accompany this?
> 
> The code above is syntactly invalid, so it will not run.
> 
> ....
> 
> Your final print statements need an extra closing parenthesis each.
> 
> 

Other comments -

The line that appends probably wants to be in the loop, and is not.

Is there a reason you're subsequently processing only the last line?


-- 
DaveA




More information about the Python-list mailing list