Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

Feature request: New string conversion type to ignore list item


Hi,
let's assume you want to nicely print the content of a list except for
one (or some)
individual item. You could do it like this:

t = ["foo", "skip me", 1, 2, 3]
print("text: %s\nvalues: %i %i %i" % (t[0], t[2], t[3], t[4]))

If there was a conversion type which simply ignores the corresponding
list item
- let's call it "%v" like "void" - things would be much easier:

t = ["foo", "skip me", 1, 2, 3]
print("text: %s\nvalues: %v%i %i %i" % t)

I guess that this new conversion type wouldn't break any existing
code.
What do you think?

Cheers,
Tom

 thomas.p@gmail.com wrote:
> let's assume you want to nicely print the content of a list except for
> one (or some) individual item. You could do it like this:
> t = ["foo", "skip me", 1, 2, 3]
> print("text: %s\nvalues: %i %i %i" % (t[0], t[2], t[3], t[4]))

or like this:

>>> "%s %.s %s" % ("first", "second", "third")

'first  third'

Peter

On 5 Jun., 13:12, Peter Otten <__pete@web.de> wrote:

> or like this:

> >>> "%s %.s %s" % ("first", "second", "third")

> 'first  third'

Hey, that's great, thanks Peter!

Tom

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc