Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'rename': 0.07; 'python': 0.09; 'script,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'file,': 0.15; 'binaries': 0.16; 'inclined': 0.16; 'line.split()': 0.16; 'subject:Discussion': 0.16; 'wrote:': 0.17; 'trying': 0.21; 'earlier': 0.21; 'subject:Code': 0.22; 'help.': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'statement': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'common': 0.26; 'right.': 0.27; 'timely': 0.27; 'all.': 0.28; 'chris': 0.28; 'post': 0.28; 'subject:some': 0.29; 'convert': 0.29; 'points': 0.29; 'words': 0.29; 'usually': 0.30; 'file': 0.32; 'print': 0.32; 'says': 0.33; 'received:google.com': 0.34; 'done': 0.34; 'thanks': 0.34; 'path': 0.35; 'said,': 0.35; 'skip:f 40': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'mean': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'your': 0.60; 'july': 0.60; 'from:no real name:2**0': 0.60; 'close': 0.63; 'more': 0.63; 'jul': 0.65; 'dear': 0.66; 'bag': 0.75; "'with'": 0.84; 'mistakes.': 0.84; 'try.': 0.91 Newsgroups: comp.lang.python Date: Sun, 8 Jul 2012 10:05:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=122.161.243.53; posting-account=6SonuQoAAACzSakS5dCECcJQe6ylLrzY References: <3c4e2ef9-bf7e-4fbc-bf12-6780fdc3e5d4@googlegroups.com> <09adb3cf-f3f2-4acc-b561-a36dcf15ecc7@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 122.161.243.53 MIME-Version: 1.0 Subject: Re: Discussion on some Code Issues From: subhabangalore@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1341767161 news.xs4all.nl 6888 [2001:888:2000:d::a6]:60920 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25046 On Sunday, July 8, 2012 1:33:25 PM UTC+5:30, Chris Angelico wrote: > On Sun, Jul 8, 2012 at 3:42 PM, wrote: > > Thanks for pointing out the mistakes. Your points are right. So I am trying to revise it, > > > > file_open=open("/python32/doc1.txt","r") > > for line in file_open: > > line_word=line.split() > > print (line_word) > > Yep. I'd be inclined to rename file_open to something that says what > the file _is_, and you may want to look into the 'with' statement to > guarantee timely closure of the file, but that's a way to do it. > > Also, as has already been mentioned: keeping your data files in the > Python binaries directory isn't usually a good idea. More common to > keep them in the same directory as your script, which would mean that > you don't need a path on it at all. > > ChrisA Dear Chirs, No file path! Amazing. I do not know I like to know one small example please. Btw, some earlier post said, line.split() to convert line into bag of words can be done with power(), but I did not find it, if any one can help. I do close files do not worry. New style I'd try. Regards, Subha