t335.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. print "----Start 01"
  2. try:
  3. print "First try"
  4. try:
  5. print "Second try - should see Second except next"
  6. i = int('badint');
  7. print "Second try - should not see this"
  8. except:
  9. print "Second except"
  10. print "First try - should see First except next"
  11. i = float('otherbadint')
  12. print "First try - should not see this"
  13. except:
  14. print "First except"
  15. print "----End 01"
  16. print "----Start 02"
  17. try:
  18. print "First try"
  19. try:
  20. print "Second try"
  21. except:
  22. print "Second except - should not see this"
  23. print "First try - should see First except next"
  24. i = float('otherbadint')
  25. print "First try - should not see this"
  26. except:
  27. print "First except"
  28. print "----End 02"
  29. print "----Start 03"
  30. try:
  31. print "First try"
  32. try:
  33. print "Second try"
  34. except:
  35. print "Second except - should not see this"
  36. print "First try - after inner try"
  37. except:
  38. print "First except - should not see this"
  39. print "----End 03"
  40. print "----Start 04"
  41. try:
  42. print "First try - shuold see First Except next"
  43. i = int('first');
  44. print "First try - should not see this"
  45. except:
  46. print "First except"
  47. try:
  48. print "Second try - should see Second except next"
  49. i = int('badint');
  50. print "Second try - should not see this"
  51. except:
  52. print "Second except"
  53. print "First except - After inner try/except"
  54. print "----End 04"
  55. print "----Start 05"
  56. try:
  57. print "First try"
  58. try:
  59. print "Second try - should see Second except next"
  60. i = int('badint');
  61. print "Second try - should not see this"
  62. except:
  63. print "Second except - should see First except next"
  64. i = float('otherbadint')
  65. print "Second except - should not see this"
  66. print "First try - should not see this"
  67. except:
  68. print "First except"
  69. print "----End 05"
  70. print "----Start 06"
  71. try:
  72. print "First try"
  73. if 123 < 12345 :
  74. if 456 < 4567 :
  75. print "You should see this"
  76. else:
  77. print "You should not see this (inner)"
  78. else:
  79. print "You should not see this"
  80. print "First try - near the end"
  81. except:
  82. print "First except - should not see this"
  83. print "----End 06"
  84. print "----Start 07"
  85. try:
  86. print "First try"
  87. if 123 < 12345 :
  88. if 456 < 4567 :
  89. print "Next you should see First except"
  90. i = int('badint')
  91. else:
  92. print "You should not see this (inner)"
  93. else:
  94. print "You should not see this"
  95. print "First try - near the end - you should not see this"
  96. except:
  97. print "First except - should see this"
  98. print "----End 07"