nums = [1,2,3,4,5]
s = sum(x *x for x in nums)
print(s)
import os
files = os.listdir('/home/zhang/PycharmProjects/flask_three/cookbook')
print(files)
if any(name.endswith('.py') for name in files):
print('这里有python文件')
else:
print('啥也没有')
portfolio = [
{'name':'GOOG', 'shares': 50},
{'name':'YHOO', 'shares': 75},
{'name':'AOL', 'shares': 20},
{'name':'SCOX', 'shares': 65}
]
min_shares = min(portfolio,key= lambda x:x['shares'])
print(min_shares)
扣剑书生
发布了460 篇原创文章 · 获赞 13 · 访问量 5052
私信
关注