Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'things.': 0.05; 'python': 0.09; 'files:': 0.09; 'flush': 0.09; 'occasionally': 0.09; 'other,': 0.09; 'referencing': 0.09; 'script,': 0.09; 'to:addr:comp.lang.python': 0.09; 'wrong,': 0.09; 'cc:addr:python- list': 0.10; 'ignore': 0.13; 'properly': 0.15; '>>': 0.16; '.py': 0.16; 'binaries': 0.16; 'exceptions;': 0.16; 'line.split()': 0.16; 'nearest': 0.16; 'skip:f 60': 0.16; 'subject:Discussion': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'email addr:gmail.com>': 0.20; 'issue.': 0.20; 'earlier': 0.21; 'fairly': 0.21; 'subject:Code': 0.22; 'help.': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'example': 0.23; '>': 0.23; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'common': 0.26; 'am,': 0.27; 'correct': 0.28; 'received:209.85.212': 0.28; 'all.': 0.28; 'chris': 0.28; 'run': 0.28; 'post': 0.28; 'subject:some': 0.29; 'convert': 0.29; 'words': 0.29; "i'm": 0.29; 'usually': 0.30; 'function': 0.30; 'problem.': 0.32; 'file': 0.32; 'says': 0.33; 'problem': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'done': 0.34; 'path': 0.35; 'said,': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'closing': 0.36; 'useful': 0.36; 'thank': 0.36; 'previous': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'mean': 0.38; 'some': 0.38; 'sure': 0.38; 'called': 0.39; 'your': 0.60; 'group,': 0.60; 'july': 0.60; 'from:no real name:2**0': 0.60; 'kind': 0.61; 'close': 0.63; 'necessarily': 0.63; 'worth': 0.63; 'more': 0.63; 'visit': 0.64; 'taking': 0.65; 'jul': 0.65; 'dear': 0.66; 'talking': 0.66; 'soon': 0.70; 'bag': 0.75; "'with'": 0.84; 'about,': 0.84; 'habit': 0.91; 'received:209.85.212.56': 0.91; 'rick': 0.91; 'try.': 0.91 Newsgroups: comp.lang.python Date: Mon, 16 Jul 2012 07:17:26 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=122.161.78.224; posting-account=6SonuQoAAACzSakS5dCECcJQe6ylLrzY References: <3c4e2ef9-bf7e-4fbc-bf12-6780fdc3e5d4@googlegroups.com> <09adb3cf-f3f2-4acc-b561-a36dcf15ecc7@googlegroups.com> <11832de7-a064-494e-b3e8-32a2f15a6902@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 122.161.78.224 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342448250 news.xs4all.nl 6911 [2001:888:2000:d::a6]:42447 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25419 On Sunday, July 8, 2012 10:47:00 PM UTC+5:30, Chris Angelico wrote: > On Mon, Jul 9, 2012 at 3:05 AM, <subhabangalore@gmail.com> wrote: > > On Sunday, July 8, 2012 1:33:25 PM UTC+5:30, Chris Angelico wrote: > >> On Sun, Jul 8, 2012 at 3:42 PM, <subhabangalore@gmail.com> wrote: > >> > file_open=open("/python32/doc1.txt","r") > >> 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. > > No file path! Amazing. I do not know I like to know one small example please. > > open("doc1.txt","r") > > Python will look for a file called doc1.txt in the directory you run > the script from (which is often going to be the same directory as your > .py program). > > > 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. > > I don't know what power() function you're talking about, and can't > find it in the previous posts; the nearest I can find is a post from > Ranting Rick which says a lot of guff that you can ignore. (Rick is a > professional troll. Occasionally he says something useful and > courteous; more often it's one or the other, or neither.) > > As to the closing of files: There are a few narrow issues that make it > worth using the 'with' statement, such as exceptions; mostly, it's > just a good habit to get into. If you ignore it, your file will > *usually* be closed fairly soon after you stop referencing it, but > there's no guarantee. (Someone else will doubtless correct me if I'm > wrong, but I'm pretty sure Python guarantees to properly flush and > close on exit, but not necessarily before.) > > ChrisA Dear Group, The problem is more or less solved. Thank you for giving varied ways of thinking on the problem. Everytime I visit the group I learn so many things. Thank you all for taking your kind time to try to absolve the issue. Regards, Subhabrata Banerjee.