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


Groups > comp.lang.python > #52746

Re: Replace blanks with letter

From Dave Angel <davea@davea.name>
Subject Re: Replace blanks with letter
Date 2013-08-20 21:54 +0000
References <2bdbd16f-a676-4973-9866-db93b1b9cd9b@googlegroups.com> <102afb35-1c8d-4957-9e9c-14b17429437b@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.66.1377035672.19984.python-list@python.org> (permalink)

Show all headers | View raw


eschneider92@comcast.net wrote:

> Is there also a way to have the code remember what I typed and not stop after the first letter the user types? For example, if I typed 'a' once, thus returning 'a______', and then typed in 'b', I want the code to return 'ab_____' and so on. I wasn't clear about this part in my original post. Thanks for the help.

First you need some kind of loop.  There's only one call to input() in
your present code, so the question is meaningless.

Roughly speaking, make sure the following line is NOT in your loop:

blanks='_ '*len(letters)

-- 
DaveA

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


Thread

Replace blanks with letter eschneider92@comcast.net - 2013-08-20 01:35 -0700
  Re: Replace blanks with letter Fábio Santos <fabiosantosart@gmail.com> - 2013-08-20 10:16 +0100
  Re: Replace blanks with letter Peter Otten <__peter__@web.de> - 2013-08-20 11:19 +0200
  Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-20 13:45 -0700
    Re: Replace blanks with letter Dave Angel <davea@davea.name> - 2013-08-20 21:54 +0000
  Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-21 00:49 -0700
    Re: Replace blanks with letter Chris Angelico <rosuav@gmail.com> - 2013-08-21 19:24 +1000
    Re: Replace blanks with letter Dave Angel <davea@davea.name> - 2013-08-21 11:42 +0000
    Re: Replace blanks with letter John Gordon <gordon@panix.com> - 2013-08-21 14:35 +0000
  Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-22 15:42 -0700
    Re: Replace blanks with letter Dave Angel <davea@davea.name> - 2013-08-23 01:28 +0000
  Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-22 15:44 -0700

csiph-web