On 30 Mar 2007 08:38:27 -0700, kevinliu23 <[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> I want to be able to insert a '-' character in front of all numeric
> values in a string. I want to insert the '-' character to use in
> conjunction with the getopt.getopt() function.
...
> "2a 3ab" into "-2a -3ab"
On Mar 30, 2007, at 5:42 PM, Michael Bentley wrote:
> for i in yourstring.split():
> if i[0].isdigit():
> yourstring = yourstring.replace(i, '-%s' % (i,), 1)
*OR*
yourstring ' '.join(x[0].isdigit() and '-%s' % x or x for x in
yourstring.split())
;-)
--
http://mail.pytho
On Mar 30, 2007, at 4:41 PM, Paul McGuire wrote:
> On Mar 30, 2:09 pm, Michael Bentley <[EMAIL PROTECTED]> wrote:
>> On Mar 30, 2007, at 10:38 AM, kevinliu23 wrote:
>>
>>
>>
>>
>>
>>> I want to be able to insert a '-' character in front of all numeric
>>> values in a string. I want to insert the
Paul McGuire wrote:
> On Mar 30, 2:09 pm, Michael Bentley <[EMAIL PROTECTED]> wrote:
>
>>On Mar 30, 2007, at 10:38 AM, kevinliu23 wrote:
>>
>>
>>
>>
>>
>>
>>>I want to be able to insert a '-' character in front of all numeric
>>>values in a string. I want to insert the '-' character to use in
>>>c
On Mar 30, 2:09 pm, Michael Bentley <[EMAIL PROTECTED]> wrote:
> On Mar 30, 2007, at 10:38 AM, kevinliu23 wrote:
>
>
>
>
>
> > I want to be able to insert a '-' character in front of all numeric
> > values in a string. I want to insert the '-' character to use in
> > conjunction with the getopt.get
On Mar 30, 2007, at 10:38 AM, kevinliu23 wrote:
> I want to be able to insert a '-' character in front of all numeric
> values in a string. I want to insert the '-' character to use in
> conjunction with the getopt.getopt() function.
>
> Rigt now, I'm implementing a menu system where users will b
Hey guys, thanks for the quick replies. I'm looking for something more
generic than adding it to "2a 3ab". For example, under the menu option
2, there can be upwards of 8 other suboptions. I'll see what's
suggested here and post back if I run into more problems. Thanks guys!
--
http://mail.python
In <[EMAIL PROTECTED]>, kevinliu23
wrote:
> "2a 3ab" into "-2a -3ab".
In [8]: '-' + ' -'.join('2a 3ab 4xy'.split())
Out[8]: '-2a -3ab -4xy'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
kevinliu23 wrote:
> Hey guys,
>
> I want to be able to insert a '-' character in front of all numeric
> values in a string. I want to insert the '-' character to use in
> conjunction with the getopt.getopt() function.
>
> Rigt now, I'm implementing a menu system where users will be able to
> sele
On Mar 30, 10:38 am, "kevinliu23" <[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> I want to be able to insert a '-' character in front of all numeric
> values in a string. I want to insert the '-' character to use in
> conjunction with the getopt.getopt() function.
>
> Rigt now, I'm implementing a menu
Hey guys,
I want to be able to insert a '-' character in front of all numeric
values in a string. I want to insert the '-' character to use in
conjunction with the getopt.getopt() function.
Rigt now, I'm implementing a menu system where users will be able to
select a set of options like "2a 3ab"
11 matches
Mail list logo