Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!feeder1-1.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'subject:Anyone': 0.09; 'wrote': 0.14; 'file1': 0.16; 'received:80.91.229.3': 0.16; 'received:97': 0.16; 'received:plane.gmane.org': 0.16; 'simpson': 0.16; 'skip:> 20': 0.16; 'subsequently': 0.16; 'wrote:': 0.18; 'print': 0.22; 'this?': 0.23; 'question': 0.24; 'header:X -Complaints-To:1': 0.27; 'code': 0.31; 'comments': 0.31; 'file': 0.32; 'probably': 0.32; 'not.': 0.33; 'subject:the': 0.34; 'there': 0.35; 'skip:> 10': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'read': 0.60; "you're": 0.61; 'sample': 0.67; 'accompany': 0.84; 'subject:know': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Anyone know the solution Date: Tue, 28 Oct 2014 22:11:26 -0400 (EDT) Organization: news.gmane.org References: <20141029005346.GA48374@cskk.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 97.73.240.68 X-Newsreader: PiaoHong.Usenet.Client.VIP:1.62 X-Archive: encrypt X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414548479 news.xs4all.nl 2855 [2001:888:2000:d::a6]:46828 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79871 Cameron Simpson Wrote in message: > On 28Oct2014 09:07, ngangsia akumbo 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