🔴 Python 那边:跑到那一行才知道
(这一段是 Python 3)
# Python 这一路:能不能用,**跑到那一行**才知道
def twice(x):
return x + x
a = twice(5)
b = twice("ab")
boom = 0
try:
twice(None) # 写下来的时候一点问题没有
except TypeError:
boom = 1
print(f"{a}/{b}/{boom}")
(这一段是 Python 3)
# Python 这一路:能不能用,**跑到那一行**才知道
def twice(x):
return x + x
a = twice(5)
b = twice("ab")
boom = 0
try:
twice(None) # 写下来的时候一点问题没有
except TypeError:
boom = 1
print(f"{a}/{b}/{boom}")
全部评论