Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79871
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re: Anyone know the solution |
| Date | 2014-10-28 22:11 -0400 |
| Organization | news.gmane.org |
| References | <f9c39375-d0ff-4f16-aa05-6d8c8fdf7267@googlegroups.com> <20141029005346.GA48374@cskk.homeip.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15277.1414548479.18130.python-list@python.org> (permalink) |
Cameron Simpson <cs@zip.com.au> Wrote in message:
> On 28Oct2014 09:07, ngangsia akumbo <ngangsia@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Anyone know the solution emmanueloje@gmail.com - 2014-10-27 08:10 -0700
Re: Anyone know the solution alister <alister.nospam.ware@ntlworld.com> - 2014-10-27 15:21 +0000
Re: Anyone know the solution Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-27 11:20 -0400
Re: Anyone know the solution Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-27 20:18 -0400
Re: Anyone know the solution Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-28 00:20 +0000
Re: Anyone know the solution alex23 <wuwei23@gmail.com> - 2014-10-28 10:33 +1000
Re: Anyone know the solution Anton <anton.schattenfeld@gmail.com> - 2014-10-28 18:28 -0700
Re: Anyone know the solution alex23 <wuwei23@gmail.com> - 2014-10-29 12:03 +1000
Re: Anyone know the solution Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-29 18:13 +1300
Re: Anyone know the solution Anton <anton.schattenfeld@gmail.com> - 2014-10-29 17:09 -0700
Re: Anyone know the solution Terry Reedy <tjreedy@udel.edu> - 2014-10-28 00:24 -0400
Re: Anyone know the solution "Mario R. Osorio" <nimbiotics@gmail.com> - 2014-10-28 08:38 -0700
Re: Anyone know the solution ngangsia akumbo <ngangsia@gmail.com> - 2014-10-28 09:07 -0700
Re: Anyone know the solution Cameron Simpson <cs@zip.com.au> - 2014-10-29 11:53 +1100
Re: Anyone know the solution Dave Angel <davea@davea.name> - 2014-10-28 22:11 -0400
Re: Anyone know the solution Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-29 18:03 +0000
csiph-web