gervaz writes:
> Hi all, I would like to ask you how I can use the more efficient join
> operation in a code like this:
>
class Test:
> ... def __init__(self, v1, v2):
> ... self.v1 = v1
> ... self.v2 = v2
> ...
def prg(l):
> ... txt = ""
> ... for x in l:
>
On Mon, Jan 3, 2011 at 3:07 AM, gervaz wrote:
> On 2 Gen, 19:14, Emile van Sebille wrote:
>>
>>
>> class Test:
>> def __init__(self, v1, v2):
>> self.v1 = v1
>> self.v2 = v2
>>
>> t1 = Test("hello", None)
>> t2 = Test(None, "ciao")
>> t3 = Test("salut", "hallo")
>> t =
Hello,
On Sun, Jan 02, 2011 at 10:11:50AM -0800, Alex
Willmer wrote:
> def prg3(l):
> return '\n'.join([str(x) for x in l if x])
just one fix (one fix one fix one fix):
return '\n'.join([str(x) for x in l if x is not None])
--
With best regards,
xrgtn
--
http://mail.python.org/mailman/
On 2 Gen, 22:37, gervaz wrote:
> On 2 Gen, 19:14, Emile van Sebille wrote:
>
>
>
>
>
> > On 1/2/2011 9:43 AM gervaz said...
>
> > > On 31 Dic 2010, 16:43, Emile van Sebille wrote:
> > >> On 12/31/2010 7:22 AM gervaz said...
>
> > >>> Hi all, I would like to ask you how I can use the more efficie
On 2 Gen, 19:14, Emile van Sebille wrote:
> On 1/2/2011 9:43 AM gervaz said...
>
>
>
>
>
> > On 31 Dic 2010, 16:43, Emile van Sebille wrote:
> >> On 12/31/2010 7:22 AM gervaz said...
>
> >>> Hi all, I would like to ask you how I can use the more efficient join
> >>> operation in a code like this:
On Sunday, January 2, 2011 5:43:38 PM UTC, gervaz wrote:
> Sorry, but it does not work
>
> >>> def prg3(l):
> ... return "\n".join([x for x in l if x])
> ...
> >>> prg3(t)
> Traceback (most recent call last):
> File "", line 1, in
> File "", line 2, in prg3
> TypeError: sequence item 0: e
On 1/2/2011 9:43 AM gervaz said...
On 31 Dic 2010, 16:43, Emile van Sebille wrote:
On 12/31/2010 7:22 AM gervaz said...
Hi all, I would like to ask you how I can use the more efficient join
operation in a code like this:
class Test:
... def __init__(self, v1, v2):
... self
On 31 Dic 2010, 16:43, Emile van Sebille wrote:
> On 12/31/2010 7:22 AM gervaz said...
>
>
>
>
>
> > Hi all, I would like to ask you how I can use the more efficient join
> > operation in a code like this:
>
> class Test:
> > ... def __init__(self, v1, v2):
> > ... self.v1 = v1
>
On 12/31/2010 7:22 AM gervaz said...
Hi all, I would like to ask you how I can use the more efficient join
operation in a code like this:
class Test:
... def __init__(self, v1, v2):
... self.v1 = v1
... self.v2 = v2
...
def prg(l):
... txt = ""
... for x in l:
...
Hi all, I would like to ask you how I can use the more efficient join
operation in a code like this:
>>> class Test:
... def __init__(self, v1, v2):
... self.v1 = v1
... self.v2 = v2
...
>>> def prg(l):
... txt = ""
... for x in l:
... if x.v1 is not None:
...
10 matches
Mail list logo