摘要:
python的join方法,列表转字符串 简单列表转字符串的方法 >>>list = ["p", "y", "t", "h", "o", "n"] >>>"".join(list) 'python' >>>"-".join(list) 'p-y-t-h-o-n' 需要注意的是:如果列表中本身是int 阅读全文
posted @ 2022-02-28 23:29
一如7697
阅读(343)
评论(0)
推荐(0)
摘要:
python类似三目运算符的方法 比较a、b中大的那个 def maxOfTwoNums(a : int, b : int): if a > b: return a else: return b 上面等价于下面的写法,采用类似三目运算符的方法 def maxOfTwoNums(a : int, b 阅读全文
posted @ 2022-02-28 22:53
一如7697
阅读(47)
评论(0)
推荐(0)
摘要:
try: pass # 可能引发异常的语句 except Exception as e: pass # 异常处理的语句,类似记录日志,打印输出 python的异常捕获 阅读全文
posted @ 2022-02-28 15:58
一如7697
阅读(66)
评论(0)
推荐(0)

浙公网安备 33010602011771号