您的位置:首页 > 编程语言 > Python开发

Python学习记录

2017-10-14 07:34 239 查看
Zip 函数可以进行多个list的迭代
for price, info, total_deal, seller, location in zip(prices, infos, total_deals, sellers, locations):
products = {
'price': price,
'info': info.strip(),
'total_deal': total_deal,
'seller': seller.strip(),
'location': location,
}
print(products)
将几个list的元素合并为一个list的方法  使用extend
A = [1,2,3]B = [3,4,5]A.extend(B)或者直接相加A + B = 一个新的list
因为学习爬虫需要redis和MongoDB
启动redis  先进入redis路径 再启用redis-server
然后就开启了redis启动MongoDB 先进入MongoDB的路径 然后再sudo mongod 即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Python