240
笔下虽有千言,胸中实无一策

随笔分类 -  Python

摘要:Python Lambda 概念 Lambda函数是一个小型匿名函数。 Lambda函数可以接受任意多个参数,但只能有一个表达式。 示例 待补充 参考 https://www.w3schools.com/python/python_lambda.asp 阅读全文
posted @ 2020-03-15 08:13 CasperWin 阅读(170) 评论(0) 推荐(0)
摘要:random.sample(population, k) Return a k length list of unique elements chosen from the population sequence. Used for random sampling without replaceme 阅读全文
posted @ 2018-02-20 10:33 CasperWin 阅读(463) 评论(0) 推荐(0)
摘要:Use dict.get(key[, default]) to assign default values The code below is functionally equivalent to the original code above, but this solution is more 阅读全文
posted @ 2018-01-11 06:41 CasperWin 阅读(283) 评论(0) 推荐(0)
摘要:Python's conditional expression is a if C else b and can't be used as: [a for i in items if C else b] The right form is: [a if C else b for i in items 阅读全文
posted @ 2017-05-12 01:15 CasperWin 阅读(515) 评论(0) 推荐(0)
摘要:In Python 3, they made the / operator do a floating-point division, and added the // operator to do integer division (i.e. quotient without remainder) 阅读全文
posted @ 2017-04-11 08:12 CasperWin 阅读(176) 评论(0) 推荐(0)
摘要:If you don't mind overwriting the original and don't want to use slicing (as mentioned in comments), you can call reverse() method on the list. >>> nu 阅读全文
posted @ 2017-02-10 03:40 CasperWin 阅读(243) 评论(0) 推荐(0)
摘要:Example import matplotlib.pyplot as plt import plotly.plotly as py # Learn about API authentication here: https://plot.ly/python/getting-started # Fin 阅读全文
posted @ 2016-12-15 05:18 CasperWin 阅读(318) 评论(0) 推荐(0)
摘要:Introducing IPython Notebook IPython isn't a different programming language, it's just a set of computer programs for working with the Python language 阅读全文
posted @ 2016-12-13 08:42 CasperWin 阅读(140) 评论(0) 推荐(0)