Thread View: pl.comp.lang.python
5 messages
5 total messages
Started by Piotr Hosowicz
Thu, 26 Mar 2009 18:35
Czy jest takie idiomatyczne sformułowanie? "" jeśli wartość Null
Author: Piotr Hosowicz
Date: Thu, 26 Mar 2009 18:35
Date: Thu, 26 Mar 2009 18:35
15 lines
1117 bytes
1117 bytes
Witam, x = Null y = "Cos" "%s %s" % (x,y) ... daje "None Cos" Na razie radzę sobie ifami-elsami, ale czy jest jakieś idiomatyczne sformułowanie w Pythonie które to rozwiązuje? Z góry dziękuję, Piotr Hosowicz
Re: Czy jest takie idiomatyczne sformułowanie? "" jeśli wartość Null
Author: Radomir Dopieralski
Date: Thu, 26 Mar 2009 18:46
Date: Thu, 26 Mar 2009 18:46
21 lines
1662 bytes
1662 bytes
At Thu, 26 Mar 2009 19:35:21 +0100, Piotr Hosowicz wrote: > Witam, > > x = Null > y = "Cos" > > "%s %s" % (x,y) > > ... daje "None Cos" > > Na razie radzę sobie ifami-elsami, ale czy jest jakieś idiomatyczne > sformułowanie w Pythonie które to rozwiązuje? Ale co rozwiazuje? Opisales zachowanie, ktore jest jak najbardziej normalne w pythonie, ale nie problem. Co chcialbys uzyskac? -- Radomir Dopieralski, http://sheep.art.pl
Re: Czy jest takie idiomatyczne sformułowanie? "" jeśli wartość Null
Author: Wojciech Muła
Date: Thu, 26 Mar 2009 18:51
Date: Thu, 26 Mar 2009 18:51
16 lines
1352 bytes
1352 bytes
On Thu, 26 Mar 2009 19:35:21 +0100 Piotr Hosowicz <adresat.nieprawidlowski@op.pl> wrote: > Witam, > > x = Null > y = "Cos" > > "%s %s" % (x,y) > > ... daje "None Cos" > > Na razie radzę sobie ifami-elsami, ale czy jest jakieś idiomatyczne > sformułowanie w Pythonie które to rozwiązuje? "%s %s" % (x or 'domyślny X', y or 'domyślny Y')
Re: Czy jest takie idiomatyczne sformułowanie? "" jeśli wartość Null
Author: forgems
Date: Thu, 26 Mar 2009 18:53
Date: Thu, 26 Mar 2009 18:53
20 lines
1628 bytes
1628 bytes
On Mar 26, 7:35 pm, Piotr Hosowicz <adresat.nieprawidlow...@op.pl> wrote: > Witam, > > x = Null > y = "Cos" > > "%s %s" % (x,y) > > ... daje "None Cos" > > Na razie radzę sobie ifami-elsami, ale czy jest jakieś idiomatyczne > sformułowanie w Pythonie które to rozwiązuje? > > Z góry dziękuję, > > Piotr Hosowicz Moze to: "%s %s" % (x or '',y or '') ?
Re: Czy jest takie idiomatyczne sformułowanie? "" jeśli wartość Null
Author: Piotr Hosowicz
Date: Thu, 26 Mar 2009 19:58
Date: Thu, 26 Mar 2009 19:58
23 lines
1489 bytes
1489 bytes
Wojciech Muła wrote: > On Thu, 26 Mar 2009 19:35:21 +0100 Piotr Hosowicz > <adresat.nieprawidlowski@op.pl> wrote: > >> Witam, >> >> x = Null >> y = "Cos" >> >> "%s %s" % (x,y) >> >> ... daje "None Cos" >> >> Na razie radzę sobie ifami-elsami, ale czy jest jakieś idiomatyczne >> sformułowanie w Pythonie które to rozwiązuje? > > "%s %s" % (x or 'domyślny X', y or 'domyślny Y') Dzięki Wam obydwu, Panowie. Pozdrawiam, Piotr Hosowicz
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads