Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6122
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:while': 0.07; 'python': 0.08; 'statement.': 0.09; 'string)': 0.09; 'pm,': 0.10; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'subject:file': 0.14; 'wrote:': 0.14; "'r')": 0.16; 'angelico': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:user': 0.16; 'input': 0.17; 'tue,': 0.17; 'header:In-Reply-To:1': 0.21; 'loop': 0.22; 'trying': 0.23; "user's": 0.23; 'message-id:@mail.gmail.com': 0.28; '(the': 0.28; 'closing': 0.28; 'received:209.85.214': 0.28; '24,': 0.29; 'subject:HELP': 0.29; "'a')": 0.30; 'it.': 0.31; 'to:addr:python-list': 0.33; '...': 0.34; 'chris': 0.34; 'file': 0.34; '\xa0\xa0\xa0': 0.34; 'using': 0.35; 'open': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'trouble': 0.39; 'should': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'subject:, ': 0.60; 'hope': 0.60; 'best': 0.60; 'your': 0.60; 'here': 0.66; 'luck': 0.73 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=6ERbZR4i1dqjMfbGgI3ml6wewiEUnAZiINTwn+Xwcs0=; b=oZDwszIWR1i+Vp6GgK1C1R+IrSZtdfGGFxrZuIg3EzzoMKxrrE4YQ7nKZkPngkCQBL OllZn2BOkm/FI0djirn1i54eoNudmmw9WzaLBRBILqWV+TxT5dfkQ3UGbfQNoixt+52S O0tmFSHzEZU1OlaJ8Q+RSg1EKbuiFkJu30SPE= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=kJisXVprKLExHo0tMNRV6QWyqzk97s1tDFc2Qq2d/QfTev4/sLgJ1+MuP6wTQ3jPe3 zPM06CFd05p5CWXc6XcP6YCWm2ZKhq5YjTin6VXnUhKO+mzi+O1ipnW0oogLPfwDnYa2 HN56moFbzCK5re1jq0RYkjrJSu776Ucy20xdo= |
| MIME-Version | 1.0 |
| In-Reply-To | <BANLkTinh6V3-DtdU5davGdP5a53a2eDF_Q@mail.gmail.com> |
| References | <BANLkTinh6V3-DtdU5davGdP5a53a2eDF_Q@mail.gmail.com> |
| Date | Tue, 24 May 2011 18:46:32 +1000 |
| Subject | Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| 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.2006.1306226795.9059.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306226795 news.xs4all.nl 49038 [::ffff:82.94.164.166]:36139 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6122 |
Show key headers only | View raw
On Tue, May 24, 2011 at 6:31 PM, Cathy James <nambo4jb@gmail.com> wrote:
> s = input ('enter name: ').strip()
Are you using Python 2 or Python 3? If it's Python 2, this should be
raw_input().
> f = open ('c:/testing.txt', 'a')
> ...
> f = open ('c:/testing.txt', 'r')
You may be having trouble here as a result of not closing the file and
then trying to reopen it.
Also, at some point you have to check if 's' (the user's inputted
string) is empty. You can then leave the loop using the 'break'
statement.
Hope that helps! Best of luck with your homework.
Chris Angelico
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: NEED HELP- read file contents, while loop to accept user input, and enter to exit Chris Angelico <rosuav@gmail.com> - 2011-05-24 18:46 +1000
csiph-web