
python
湖南大学研究生-杜敏
Github:https://github.com/zscdumin
欢迎关注个人博客:https://zscdumin.github.io/
展开
-
IDEA同时打开多个分支
IDEA 同时打开多个分支进行开发原创 2022-06-02 16:25:45 · 4946 阅读 · 1 评论 -
python 分组合并元素
python 分组合并元素问题描述:将用户点击过的物品进行合并,返回用户点击记录的字典数组.此处用到了python字典进行处理.1. 实例分析import pandas as pdres = {}data = [[0, 0, 1], [0, 1, 1], [0, 2, 1], [1, 1, 1], [1, 2, 1]] # [u_id, i_id, rating]for item in data: res.setdefault(item[0], []).append(item[1原创 2020-07-12 11:16:28 · 669 阅读 · 0 评论 -
Python 多进程与多线程优化
Python 多进程与多线程优化Python 多线程代码from time import ctime, sleepimport threadingimport numpy as npimport collections loops = [1e6,1e7]class MyThread(threading.Thread): def __init__(self, func, args, name=''): threading.Thread.__init__(self)原创 2020-05-26 11:15:16 · 683 阅读 · 0 评论 -
python append和extend的区别
python append和extend的区别1. appendappend可以添加单个元素,也可以添加可迭代对象2. extendextend只能添加可迭代对象3. 代码示例:arr_ap = [1,2,3,4]item = [5,6,7]arr_ap.append(item)In [160]:arr_apOut[160]:[1, 2, 3, 4, [5, 6, 7]]...原创 2020-01-08 19:41:22 · 4815 阅读 · 0 评论