Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25038

Re: Discussion on some Code Issues

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
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; 'file,': 0.15; 'binaries': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'inclined': 0.16; 'subject:Discussion': 0.16; 'wrote:': 0.17; 'trying': 0.21; 'received:209.85.214.174': 0.21; 'subject:Code': 0.22; "i'd": 0.22; 'statement': 0.23; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'right.': 0.27; 'timely': 0.27; 'message- id:@mail.gmail.com': 0.27; 'all.': 0.28; 'subject:some': 0.29; 'points': 0.29; 'usually': 0.30; 'file': 0.32; 'print': 0.32; 'says': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'path': 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; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'more': 0.63; 'jul': 0.65; "'with'": 0.84; 'mistakes.': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=OGYBNr6ii3Ncn56MZPIyZpySGWoY0ixZT7Bo2Seji7Y=; b=m9VuzPfaywIUgfyDXYcKq3jGTCTwsexQ/SwW53euhIZm8DgmmplI9/gQWoIsMqjFWi XQ08ynFmn+kzqgsEslzkFX+SPvDed8h9jYHv9zJK8FDby2/3YAaEKpFekXh7EWdLf79M JZdXS2pDNSO/V8X+h+uKh0F5QhYqGnddKBTSrPOl/3WgLmyLAdyuIBe9Sc8wLNyJpA0/ iGVif7muMst3Z3c7IBoG0gXnnZZ0NH+UO/lG5/ddGx0/dcoAstcYSj7scyEYVVrAzL5V qkBZJS0s1ZmZz1b4iGZAH4P3lt5FRQCjD3YQD/mMsiS0JmBnnClQrn5iLdw4Tx7s2glw dv2w==
MIME-Version 1.0
In-Reply-To <09adb3cf-f3f2-4acc-b561-a36dcf15ecc7@googlegroups.com>
References <a4f0e2a9-cc3b-4081-beb9-82f229e95ba1@googlegroups.com> <3c4e2ef9-bf7e-4fbc-bf12-6780fdc3e5d4@googlegroups.com> <mailman.1901.1341694286.4697.python-list@python.org> <09adb3cf-f3f2-4acc-b561-a36dcf15ecc7@googlegroups.com>
Date Sun, 8 Jul 2012 18:03:25 +1000
Subject Re: Discussion on some Code Issues
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1910.1341734607.4697.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341734607 news.xs4all.nl 6939 [2001:888:2000:d::a6]:51282
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25038

Show key headers only | View raw


On Sun, Jul 8, 2012 at 3:42 PM,  <subhabangalore@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-04 16:21 -0700
  Re: Discussion on some Code Issues Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-05 00:02 +0000
  Re: Discussion on some Code Issues Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-04 17:08 -0700
  Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-04 20:25 -0700
    Re: Discussion on some Code Issues Peter Otten <__peter__@web.de> - 2012-07-05 09:30 +0200
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-05 07:33 -0700
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-05 07:33 -0700
        Re: Discussion on some Code Issues Peter Otten <__peter__@web.de> - 2012-07-06 09:35 +0200
  Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-07 12:54 -0700
    Re: Discussion on some Code Issues Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-07 16:51 -0400
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-07 22:42 -0700
        Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-08 18:03 +1000
          Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-08 10:05 -0700
            Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-09 03:17 +1000
              Re: Discussion on some Code Issues Roy Smith <roy@panix.com> - 2012-07-08 14:17 -0400
                Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-09 07:54 +1000
                Re: Discussion on some Code Issues Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-09 00:57 +0000
                Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-09 18:41 +1000
                Re: Discussion on some Code Issues Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-09 12:24 +0000
                Re: Discussion on some Code Issues Chris Angelico <rosuav@gmail.com> - 2012-07-10 00:47 +1000
                Re: Discussion on some Code Issues Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-09 12:49 -0400
              Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-16 07:17 -0700
              Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-16 07:17 -0700
            Re: Discussion on some Code Issues MRAB <python@mrabarnett.plus.com> - 2012-07-08 19:27 +0100
          Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-08 10:05 -0700
        Re: Discussion on some Code Issues Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-08 15:07 -0400
      Re: Discussion on some Code Issues subhabangalore@gmail.com - 2012-07-07 22:42 -0700

csiph-web