Python 库函数学习记录
当前正在写 leetcode 的题目,所以可能会经常用到 Python 的库函数,因此,在这里作一个记录,好记性不如烂键盘。
sort 函数
A simple ascending sort is very easy: just call the sorted() function. It returns a new sorted list:
You can also use the list.sort() method. It modifies the list in-place (and returns None to avoid confusion). Usually it’s less convenient than sorted() - but if you don’t need the original list, it’s slightly more efficient.
Another difference is that the list.sort() method is only defined for lists. In contrast, the sorted() function accepts any iterable.
abs 函数
abs(x)
Return the absolute value of a number. The argument may be an integer, a floating point number, or an object implementing abs(). If the argument is a complex number, its magnitude is returned.
Python 库函数学习记录
http://fanyfull.github.io/2021/11/28/Python-库函数学习记录/