On 2/10/2010 2:57 PM, Grant Edwards wrote:
On 2010-02-10, pyt...@bdurham.com wrote:
[regardning "picture" output format specifiers]
I was thinking that there was a built-in function for this
common(?) use case
I haven't seen that paradigm since my one-and-only exposure to
COBOL in a class I
On Wed, Feb 10, 2010 at 12:19 PM, sstein...@gmail.com
wrote:
> On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote:
>> On 2010-02-10, pyt...@bdurham.com wrote:
>>
>> [regardning "picture" output format specifiers]
>>
>>> I was thinking that there was a built-in function for this
>>> common(?) use ca
On Feb 10, 2010, at 3:40 PM, Grant Edwards wrote:
> On 2010-02-10, sstein...@gmail.com wrote:
>> On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote:
>>
>>> On 2010-02-10, pyt...@bdurham.com wrote:
>>>
>>> [regardning "picture" output format specifiers]
>>>
I was thinking that there was a
On 2010-02-10, sstein...@gmail.com wrote:
> On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote:
>
>> On 2010-02-10, pyt...@bdurham.com wrote:
>>
>> [regardning "picture" output format specifiers]
>>
>>> I was thinking that there was a built-in function for this
>>> common(?) use case
>>
>> I hav
Grant Edwards wrote:
[regardning "picture" output format specifiers]
I was thinking that there was a built-in function for this
common(?) use case
I haven't seen that paradigm since my one-and-only exposure to
COBOL in a class I took back in 1979. Is the "picture" thing
commonly used in other
On Feb 10, 2010, at 2:57 PM, Grant Edwards wrote:
> On 2010-02-10, pyt...@bdurham.com wrote:
>
> [regardning "picture" output format specifiers]
>
>> I was thinking that there was a built-in function for this
>> common(?) use case
>
> I haven't seen that paradigm since my one-and-only exposure
On 2010-02-10, pyt...@bdurham.com wrote:
[regardning "picture" output format specifiers]
> I was thinking that there was a built-in function for this
> common(?) use case
I haven't seen that paradigm since my one-and-only exposure to
COBOL in a class I took back in 1979. Is the "picture" thing
Tim Chase wrote:
pyt...@bdurham.com wrote:
Original poster here.
Thank you all for your ideas. I certainly learned some great techniques
by studying everyone's solutions!!
Thanks for the positive feedback -- it's something most folks like to
hear when they try to assist and such thanks appea
On 10/02/2010 20:36, pyt...@bdurham.com wrote:
def picture(s, pic, placeholder='@'):
nextchar=iter(s).next
return ''.join(nextchar() if i == placeholder else i for i in pic)
Hell's teeth - even I understood that! Amazing solution.
\d
--
Fonty Python and Things! -- http://otherwise.re
needed to learn :)
Thanks again!
Malcolm
- Original message -
From: "Arnaud Delobelle"
To: python-list@python.org
Date: Wed, 10 Feb 2010 18:21:35 +0000
Subject: Re: Creating formatted output using picture strings
pyt...@bdurham.com writes:
> Original poster here.
>
&g
Hi Tim,
Thank you very much for your update to MRAB's creative solution.
> You don't give the expected output for these test cases, so
> it's hard to tell whether you want to pad-left or pad-right.
To be honest, I wasn't sure myself :)
My original post was the result of doing some simple forma
pyt...@bdurham.com writes:
> Original poster here.
>
> Thank you all for your ideas. I certainly learned some great techniques
> by studying everyone's solutions!!
>
> I was thinking that there was a built-in function for this common(?) use
> case which is why I shied away from writing my own in t
pyt...@bdurham.com wrote:
Original poster here.
Thank you all for your ideas. I certainly learned some great techniques
by studying everyone's solutions!!
Thanks for the positive feedback -- it's something most folks
like to hear when they try to assist and such thanks appears too
rarely on
Original poster here.
Thank you all for your ideas. I certainly learned some great techniques
by studying everyone's solutions!!
I was thinking that there was a built-in function for this common(?) use
case which is why I shied away from writing my own in the first place
... hoping to not-reinven
On Wed, Feb 10, 2010 at 1:45 AM, Peter Otten <__pete...@web.de> wrote:
> A basic implementation without regular expressions:
>
> >>> def picture(s, pic, placeholder="@"):
> ... parts = pic.split(placeholder)
> ... result = [None]*(len(parts)+len(s))
> ... result[::2] = parts
> ...
Olof Bjarnason wrote:
2010/2/10 Peter Otten <__pete...@web.de>:
pyt...@bdurham.com wrote:
Does Python provide a way to format a string according to a
'picture' format?
For example, if I have a string '123456789' and want it formatted
like '(123)-45-(678)[9]', is there a module or function tha
2010/2/10 Alf P. Steinbach :
> * Olof Bjarnason:
>>
>> 2010/2/10 Peter Otten <__pete...@web.de>:
>>>
>>> pyt...@bdurham.com wrote:
>>>
Does Python provide a way to format a string according to a
'picture' format?
For example, if I have a string '123456789' and want it formatted
* Olof Bjarnason:
2010/2/10 Peter Otten <__pete...@web.de>:
pyt...@bdurham.com wrote:
Does Python provide a way to format a string according to a
'picture' format?
For example, if I have a string '123456789' and want it formatted
like '(123)-45-(678)[9]', is there a module or function that wi
2010/2/10 Peter Otten <__pete...@web.de>:
> pyt...@bdurham.com wrote:
>
>> Does Python provide a way to format a string according to a
>> 'picture' format?
>>
>> For example, if I have a string '123456789' and want it formatted
>> like '(123)-45-(678)[9]', is there a module or function that will
>>
pyt...@bdurham.com wrote:
> Does Python provide a way to format a string according to a
> 'picture' format?
>
> For example, if I have a string '123456789' and want it formatted
> like '(123)-45-(678)[9]', is there a module or function that will
> allow me to do this or do I need to code this typ
On Tue, Feb 9, 2010 at 8:45 PM, wrote:
> Does Python provide a way to format a string according to a 'picture'
> format?
>
> For example, if I have a string '123456789' and want it formatted like
> '(123)-45-(678)[9]', is there a module or function that will allow me to do
> this or do I need to
Does Python provide a way to format a string according to a
'picture' format?
For example, if I have a string '123456789' and want it formatted
like '(123)-45-(678)[9]', is there a module or function that will
allow me to do this or do I need to code this type of
transformation myself?
Thank you,
22 matches
Mail list logo