ICode9

精准搜索请尝试: 精确搜索
  • 读取excel用字典存储2022-06-13 00:31:48

    # 传入二维数组,以第一行作为字典关键字,存储数据 def list_turn_dict(tlist: list): key = [] for i in range(len(tlist)): dict_f = {} if i == 0: key = tlist[i] else: for j in range(len(key)): d

  • [LintCode] 194. Find Words2022-06-12 08:32:48

    Given a string str and a dictionary dict, you need to find out which words in the dictionary are subsequences of the string and return those words.The order of the words returned should be the same as the order in the dictionary. |str|<=1000 the su

  • 【dict】dict和json相互转换2022-06-12 06:00:22

    dict与json相互转换之前要导包import json import json d_json = '{"B": 2, "a": 1}'d_dict = json.loads(d_json)d_dict['c'] = 101d_json2 = json.dumps(d_dict)print(d_dict) # {'B': 2, 'a': 1, 'c': 1

  • 代码笔记13 pytorch冻结部分参数的坑2022-06-10 23:33:49

    问题   关于在pytorch中冻结参数,我看网上大多都使用了 for param in net.parameters(): param.requires_grad = False   但我的需求是这样的,我创建了一个dict,里面含有对应的tensor的name与param,我想让根据这些名称对网络的参数进行冻结,这就用到了一个我们平时经常使用的

  • 爬取B站UP主信息2022-06-10 18:41:40

    爬取方式 直接搜索UP主,按F12打开开发者调试工具可以看到如下内容: 预览:可以看到每一个每一个URL下返回的信息 标头:可以看到对应的请求URL和响应等 响应:我们用requests.get方法得到返回的内容 用json.loads()可以将该内容转为Python的字典,方便提取信息 代码 这里我们爬取少部分信

  • 【dict】items函数2022-06-10 01:02:57

    python 列表中的items函数 用来遍历字典中的键值对 使用for i in dict.items时,遍历出来的i是tuple类型 使用for m,n in dict.items时,遍历出来的m,n为str类型 dic = {"amd": "yes", "intel": "yyds"} for i in dic.items(): print(i, type(i)) """ 结

  • 【dict】get函数2022-06-10 01:02:27

    dict中的get函数 dict.get('值',None) get函数需要有一个变量接受 一般用来判断值是否存在,若不存在则返回None None可以自定义为字符串,数字 dic = {"amd": "yes", "intel": "yyds"} ret = dic.get('amd', None) print(ret) ret = dic.get('yes'

  • leetcode(26)哈希表系列题目2022-06-08 13:34:53

    242. 有效的字母异位词 哈希表方法,可适应更大规模字符集 class Solution: def isAnagram(self, s: str, t: str) -> bool: dict_ = {} for ch in s: if ch in dict_: dict_[ch] += 1 else: dict_[ch

  • vue跨行跨列动态表格生成2022-06-07 21:36:18

    一、思路步骤: 根据后台传输的数据进行格式转化; 索引为多少的时候进行跨行; <table id="table"> <thead> <tr> <th class="field">领域</th> <th class="task">任务目标</th>

  • python 常用技巧2022-06-07 18:35:22

    简介 在实际项目或者面试中会遇到一些常用的python小技巧,其实就是所谓的内置模块,方便了开发。 字符串倒转 s = 'ASDFGH' print(s[-1::-1]) print(s[::-1]) HGFDSA HGFDSA 英文单词的首字母大写 data = 'my name is tom' print(data.title()) print(data) My Name Is Tom my nam

  • tensorflow tfserving 部署记录2022-06-06 15:05:02

    1,环境 keras2.4.3 tensorflow2.2 模型为keras的h5格式 keras-bert 0.88 wsl2下,docker环境部署,nividia-container-toolkit wsl2安装nividia-container-toolkit参考,win10版本请务必更新为21H2以上 https://docs.microsoft.com/zh-cn/windows/wsl/tutorials/gpu-compute 2,模型转PB格

  • Django使用editor实现基本使用,包括本地上传图片问题2022-06-04 21:00:38

    Django使用editor实现基本使用,包括本地上传图片问题 可以直接在这里下载editor https://files.cnblogs.com/files/blogs/737880/test.zip?t=1654347284 配置 参考博客 # 需要导入的文件: <link rel="stylesheet" href="/static/editormd/css/editormd.css"/> <script src=

  • Python - 处理属性的重要属性和函数2022-06-04 15:31:38

    目录影响属性处理方式的特殊属性 影响属性处理方式的特殊属性 __class__: 对象所属类的引用(即obj.class 与 type(obj) 的作用相同)。Python的某些特殊方法,例如__getattr__ 只在对象的类中寻找,而不在实例中寻找 __dict__: 一个映射,存储对象或类的可写属性。有__dict__属性的对象,

  • mmdetection训练的json文件可视化代码2022-06-02 13:01:28

    # coding:utf-8 # 这是一个对mmdet训练结束后的json文件进行可视化的代码 # 主要是对log中记录的各种参数如:cls_loss, box_loss, mAP进行可视化 # 本方法已经经过测试,输出图片在out文件夹中 import json import matplotlib.pyplot as plt from collections import OrderedDict #

  • 20204323 《Python程序设计》实验四报告2022-06-01 00:01:02

    20204323 太晓梅 《Python程序设计》 实验4报告 课程:《Python程序设计》 班级: 2043 姓名: 太晓梅 学号:20204323 实验教师:王志强 实验日期:2022年5月4日 必修/选修: 公选课 1.实验要求 Python综合应用:爬虫、数据处理、可视化、机器学习、神经网络、游戏、网络安全等。 课代表和各小组

  • 【Redis】字典2022-05-31 23:01:46

    Redis 字典 基本语法 字典是Redis中的一种数据结构,底层使用哈希表实现,一个哈希表中可以存储多个键值对,它的语法如下,其中KEY为键,field和value为值(也是一个键值对): HSET key field value 根据Key和field获取value: HGET key field 哈希表 数据结构 dictht dictht是哈希表的数据结构

  • Identification of Key Nodes Based on Integrating of Global and Local Information论文2022-05-31 17:32:38

      之前使用PageRank提取关键结点的方法是计算每个结点的PageRank的值,然后提取top10%的结点作为关键结点。但是PageRank是从全局视角给网页排序,从而得到的每个结点的PageRank的值。   这篇文章结合复杂网络的局部特征和全局特征,通过标准化每个节点的度和中间性中心性,利用节点之

  • 【哈希表】力扣128:最长连续序列2022-05-30 16:00:57

    给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。 请你设计并实现时间复杂度为 O(n) 的算法解决此问题。 示例: 输入:nums = [100,4,200,1,3,2] 输出:4 解释:最长数字连续序列是 [1, 2, 3, 4]。它的长度为 4。 首先想到一个方法:sorted()

  • vue $store全局变量设置2022-05-28 09:35:17

    store/modules/dict.js import { getDicts } from '@/api/index' const dict = { state: { dicts: [], }, mutations: { SET_DICT: (state, data) => { state.dicts = data }, }, actions: { getDict({ commit }) { r

  • Counter()详解2022-05-26 16:03:14

      Python collections模块之Counter详解 Counter() most_common() elements() update() subtract()   collections模块 ==> Python标准库,数据结构常用的模块;collections包含了一些特殊的容器,针对Python内置的容器,例如list、dict、set和tuple,提供了另一种选择。 col

  • 代码笔记12 PyTorch加载部分模型参数到另一个模型2022-05-25 23:33:30

    1  首先,加载是有条件的,就是两个模型想要加载的参数的名字相同,才能加载进来。 2  加载的方法有两种,load_state_dict(strict)和update 代码里的方法是对backbone单独做一个Module类,这样不容易出错。 代码中展示了如何把train_net中的backbone参数加载到test_net中的两种办法 impor

  • Python 格式化 Cookie2022-05-25 04:00:07

    """ 将 各种格式的 cookie 转为 字典格式 """ def cookie_factory(ck_str=None): cookie_dict = {} # 从浏览器 抓包 复制过来的 cookie 字符串 if ck_str: for cookie in ck_str.split(';'): try: k, v =

  • orderdict转dict2022-05-24 23:00:18

    前言 在使用django的orm模型的时候,我们经常会直接使用model.objects.all().order_by("-id") 这样获取的数据类型是orderdict,却不是我们想要的dict数据类型。那么如果想使用dict数据类型怎么办。 可以使用 import json json.load(json.dump(model.objects.all().order_by("-id")))

  • python-读取abi文件信息并绘制峰图2022-05-23 13:03:46

    1. 引入第三方库 from Bio import SeqIO import matplotlib.pyplot as plt 2. 写函数 def sequence(file_name): info_dict = {} # 绘图数据 # 检查后缀 raw = open(file_name, errors='ignore').read() if file_name[-3:] != 'ab1' or raw[:4] != &#

  • LeetCode 0139 Word Break2022-05-22 07:00:20

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 1> 状态定义: dp[i]表示字符串s前i个字符组成的字符串s[0, i-1]是否能被空格拆分成若干个字典出现的单词。 2> 边界: dp[0] = true 表示空串且合法 3> 状态转移方程 对于任意的分割点j in [0, i-1],把s[0, i-1]分隔成两部分 s1=

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有