paint-brush
编写更好的 Python 代码的 11 个技巧和窍门经过@pragativerma
2,109 讀數
2,109 讀數

编写更好的 Python 代码的 11 个技巧和窍门

经过 Pragati Verma8m2022/08/16
Read on Terminal Reader
Read this story w/o Javascript

太長; 讀書

Python 通常使用“for”循环来迭代可迭代对象。但是通过使用 `enumerate() 而不是 'for' 循环,有一种更简单、更 Pythonic 的方式来做到这一点。列表理解而不是原始 for 循环是一种基于现有列表创建列表的方法。它可用于对已排序列表或序列(元组、集合、冻结集)或集合(冻结集)中的元素进行排序。列表推导式的语法如下所示:'HackerNoon'

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - 编写更好的 Python 代码的 11 个技巧和窍门
Pragati Verma HackerNoon profile picture
Pragati Verma

Pragati Verma

@pragativerma

I am a Software Developer with a keen interest in tech content writing.

學到更多
LEARN MORE ABOUT @PRAGATIVERMA'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Pragati Verma HackerNoon profile picture
Pragati Verma@pragativerma
I am a Software Developer with a keen interest in tech content writing.

標籤

Languages

这篇文章刊登在...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite