When the and-or Trick Fails,and-orfails,a = '' b = '
When the and-or Trick Fails,and-orfails,a = '' b = '
a = '' b = 'second' print 1 and a or b# Since a is an empty string, which is false in a boolean context, #1 and '' evaluates to '', and then '' or 'second' evaluates to 'second'.
- Map string to sys.stout.write,mapsys.stout.write,impor
- Boolean operation in if,booleanoperation,# number <
- Move what you drew on a canvas,drewcanvas,from Tkinter
- List concatenation Demo,concatenationdemo,print [1, 2,
- Using sys.modules,usingsys.modules,import syspr
- Zip a two lists,ziptwolists,L1 = [1,2,3,
热门文章:
相关内容
- Map string to sys.stout.write,mapsys.stout.write,import syssh
- Boolean operation in if,booleanoperation,# number <=
- Move what you drew on a canvas,drewcanvas,from Tkinter
- List concatenation Demo,concatenationdemo,print [1, 2,
- Using sys.modules,usingsys.modules,import syspr
- Zip a two lists,ziptwolists,L1 = [1,2,3,
- String Format: Force eight digits in integer,eightdigits,integerVal
- yield statement works with for loop,yieldstatement,def gensquar
- Reading Everything: read the whole file in one go,readingwhole,f =
- Close a file after using,closeusing,import sys
评论关闭