coursera python

try and except

  • you surround a dangerous section of code with try and except.
  • if the code in the try works- the except is skipped
  • if the code in the try fails- it jumps to the except section

is

  • Python has an “is” operator that can be used in logical expresstions
  • Implies is the same as
  • Similar to, but stronger than “==”
  • is not also is a logical operator
  • 一般的には使わない。TrueやFalseのような特殊な判断のみに使う。