编辑 | sunlei
发布 | ATYUN订阅号
你是不是也和我一样厌倦了每次在Stack Overflow上搜索时忘记如何在Python中执行某些操作?...sentence_string = "my name is George"
sentence_string.split()
print(sentence_string)
4、初始化一个包含数字的列表...a = [1, 2, 3]
b = [num*2 for num in a] # Create a new list by multiplying each element in a by 2
9、迭代字典...))
10、在获取索引时迭代列表值
m = ['a', 'b', 'c', 'd']
for index, value in enumerate(m):
print('{0}: {1}'.format...test = [1, 2, 3, 4, 2, 2, 3, 1, 4, 4, 4]
print(max(set(test), key = test.count))
14、检查对象的内存使用情况
import