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


Groups > comp.lang.python > #20471

Re: writing to a file from within nested loops

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <crebert@ucsd.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'attribute': 0.07; 'snippet': 0.07; 'advance.': 0.09; 'fatal': 0.09; 'loop.': 0.09; 'error:': 0.10; 'subject:file': 0.13; 'innermost': 0.16; 'subject:loops': 0.16; 'subject:writing': 0.16; 'traceback.': 0.16; 'cc:addr:python-list': 0.16; 'syntax': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'help.': 0.19; '(which': 0.19; 'cheers,': 0.20; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'fine,': 0.23; 'stack': 0.24; 'suspect': 0.24; 'received:209.85.220': 0.25; 'cc:2**0': 0.26; 'code': 0.26; "i'm": 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'chris': 0.30; 'error': 0.30; 'thanks': 0.32; 'actual': 0.32; 'error.': 0.32; 'there': 0.33; 'loop': 0.34; 'wondering': 0.34; 'hi,': 0.34; 'someone': 0.34; 'assignment': 0.34; 'post': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'could': 0.38; 'some': 0.38; 'getting': 0.38; 'subject:from': 0.39; 'received:209': 0.39; 'might': 0.40; 'your': 0.61; 'full': 0.62; 'exact': 0.68; '12:12': 0.84; 'problematic': 0.84; 'excluded': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=simple/simple; d=ucsd.edu; i=crebert@ucsd.edu; q=dns/txt; s=041709-iport; t=1329338036; x=1360874036; h=mime-version:in-reply-to:references:date:message-id: subject:from:to:cc:content-transfer-encoding; bh=k2aW4yIKV3Mz2J6J4B4IRtg0QzF+/BIs5baSaK6OaB8=; b=QCKlJcqVA4NpL42TmeTDWlXAN/rqJClNDMZfkahGX4GXwWz8d7rlKNeD bMd7CYOZ/VHENde5CnhkXLAwoCNlvSCd2CXWi0V0UkKidnhR+3uWsAxI4 wlcjn21ZJSTwBFwaU7/O7GcNkPAdqerAmWxf2uy8mfx6VtHwRSLLjF3xE s=;
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result AtQFAL4VPE+E7/kU/2dsb2JhbABDDoUDq0wIgQeBcgEBAQEDEgIPVhALCwMKAgImAgIiEgEFARwGEyKkNAqLJoh1iQeBL4ovDAcRDAkIDhUDBQIFAwIDGAMBAoNJAgkIBgcgCYIbgRYEiE2MaYVKiF89g0tY
X-IronPort-AV E=Sophos;i="4.73,424,1325491200"; d="scan'208";a="720779439"
X-Spam-Status No
X-Spam-Level
MIME-Version 1.0
In-Reply-To <77a0e187170dca.4f3bbd59@wiscmail.wisc.edu>
References <75208cce174437.4f3bf1a2@wiscmail.wisc.edu> <77a0ddfa17203f.4f3bf1de@wiscmail.wisc.edu> <775093eb1740b6.4f3bf21b@wiscmail.wisc.edu> <7760fe7a17153d.4f3bf258@wiscmail.wisc.edu> <75909037172f2d.4f3bf294@wiscmail.wisc.edu> <76f0965b175c1f.4f3bf2d0@wiscmail.wisc.edu> <77c0ac1d173db4.4f3bf403@wiscmail.wisc.edu> <7750b096170a1e.4f3c11b5@wiscmail.wisc.edu> <77a0e187170dca.4f3bbd59@wiscmail.wisc.edu>
Date Wed, 15 Feb 2012 12:32:43 -0800
Subject Re: writing to a file from within nested loops
From Chris Rebert <crebert@ucsd.edu>
To Rituparna Sengupta <rsengupta@wisc.edu>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQlxdeArzXGGkqqs/aShMWQiSnee9o3lKjvMkLRqNET4TJ+oqHpTaK4KdBwV9hjmnxOWn6Ur
Cc python <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 <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.5852.1329338037.27778.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329338037 news.xs4all.nl 6866 [2001:888:2000:d::a6]:53112
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20471

Show key headers only | View raw


On Wed, Feb 15, 2012 at 12:12 PM, Rituparna Sengupta <rsengupta@wisc.edu> wrote:
> Hi,
>
> I'm working on this code and I keep getting an error. It might be some very basic thing but I was wondering if someone could help. Its a loop within a loop. The part outside the innermost loop gets printed fine, but the part within the innermost loop doesn't get printed. I get an error: 'str' has no attribute 'write'. Thanks in advance.

Please post your exact actual code (which this isn't; it has clear
fatal syntax errors) and the full error message, including the stack
Traceback.

I would suspect there is some problematic assignment to `f` that you
excluded from the snippet you posted.

Cheers,
Chris

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


Thread

Re: writing to a file from within nested loops Chris Rebert <crebert@ucsd.edu> - 2012-02-15 12:32 -0800

csiph-web