随笔分类 -  python

字符串处理
摘要:1.数据结构 input_dict = { 'A': { 'B': { 'C': {}, 'D': {} }, 'E': { 'F': {} } }, 'G': { 'H': {}, 'I': {} } } 2. Python 代码 def convert_dict_to_numbers(input 阅读全文
posted @ 2023-12-05 16:00 林暗惊风 阅读(47) 评论(0) 推荐(0) 编辑
摘要:input_data = [{ 'title': '试验干预中止和参与者退出试验', 'children': [ { 'title': '试验干预中止', 'children': [ { 'title': '永久中止试验干预的标准', 'children': [] }, { 'title': '暂时 阅读全文
posted @ 2023-12-05 15:42 林暗惊风 阅读(23) 评论(0) 推荐(0) 编辑
摘要:# Import librariesfrom Bio import pairwise2from Bio.Seq import Seq # Creating sample sequencesseq1 = Seq("TGTGACTA")seq2 = Seq("CATGGTCA") # Finding s 阅读全文
posted @ 2023-11-13 10:57 林暗惊风 阅读(378) 评论(0) 推荐(0) 编辑
摘要:import requests def find_children(data, elements): children_found = [] for items in data[elements]: children_found.append(items['name']) if items['chi 阅读全文
posted @ 2022-07-20 14:16 林暗惊风 阅读(125) 评论(0) 推荐(0) 编辑
摘要:import pymysql MYSQL_CONFIG = { 'host': 'localhost', # IP地址 'port': 3306, # 端口 'user': 'root', # 用户名 'passwd': 'mysql', # 密码 'db': 'test03', # 数据库 'ch 阅读全文
posted @ 2022-05-17 09:38 林暗惊风 阅读(269) 评论(0) 推荐(0) 编辑
摘要:import re data2 = "45/22.5 mg/kg""""获取整数或小数""" d2 = re.compile("\d+[.\d]*") result = re.findall(d2,data2) 阅读全文
posted @ 2022-05-12 15:46 林暗惊风 阅读(974) 评论(0) 推荐(0) 编辑
摘要:把不等长的value输出,形成DataFrame 结果报错: ValueError: arrays must all be same length d = { 'Dosage': [1,2,3,4,5], 'HalfLife':[6,7,8,9,10,11,12,13,14,15], 'Cmax': 阅读全文
posted @ 2022-05-09 11:11 林暗惊风 阅读(3505) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python # -*-encoding:utf-8-*- import pymysql # 打开数据库连接 db = pymysql.connect("localhost","root","123","testdb") # 使用 cursor() 方法创建一个游标对象 阅读全文
posted @ 2022-05-05 16:44 林暗惊风 阅读(144) 评论(0) 推荐(0) 编辑
摘要:file_name = r'C:/Users/HZJT0040/Desktop/Daliymed/410/2fbaadf6-c86c-48bb-bbba-803377841733.xml' with open(file_name, 'r', encoding='utf-8') as f: # 读取x 阅读全文
posted @ 2022-04-26 21:14 林暗惊风 阅读(201) 评论(0) 推荐(0) 编辑
摘要:import rezen = "1 aaaabbbb"m = re.findall("\d+", zen)if len(m)==1: print(m) result = zen.replace(m[0], '') print(result.strip()) 阅读全文
posted @ 2022-04-19 14:08 林暗惊风 阅读(482) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示