随笔分类 - python
摘要:一、YasDB 的 Python 驱动程序安装 1、找到yasdb的官网的下载地方 官网相关安装包下载:https://download.yashandb.com/download,下载python的驱动 2、直接使用pip方式安装python的驱动 二、ODBC驱动安装(Windows) 下载Ya
阅读全文
摘要:方案 import yasdbclass YASDBUtil: def __init__(self, host, user, password, port=1688): self.connect = yasdb.connect( host=host, port=port, user=user, pa
阅读全文
摘要:方案 class DBUtil: def __init__(self, host, database, user, password, port): self.connect = pymysql.Connect( host=host, database=database, user=user, pa
阅读全文
摘要:下载镜像优化 (推荐https) pip install requests -i https://pypi.douban.com/simple/ 豆瓣镜像 pip install requests -i http://pypi.doubanio.com/simple/ --trusted-host
阅读全文
摘要:前言 ipython是一个python的交互式shell,比默认的python shell好用得多,支持变量自动补全,自动缩进,支持bash shell命令,内置了许多很有用的功能和函数。学习ipython将会让我们以一种更高的效率来使用python。同时它也是利用Python进行科学计算和交互可视
阅读全文
摘要:代码实现: from typing import List class Solution: def maximunProduct(self, nums: List[int]) -> int: # 默认是升序 nums.sort() length = len(nums) if length == 3:
阅读全文
摘要:获取字符串中全部的回文子串 代码: def get_all_Palindrome(item:str): ''' 获取所有的回文字符串 ''' #定义列表,存放所有的回文字符串 res = [] for i in range(len(item)): for j in range(i + 1, len(
阅读全文
摘要:获取列表中最长的字符号串 代码: import numpy as np# 定义获取列表中最长元素的函数def get_longest_element(item_list: list): # 计算list每个元素的长度 len_list = map(len, item_list) # 实例化 li =
阅读全文
摘要:filter 过滤 filter() 函数用于过滤序列,过滤掉不符合条件的元素,返回由符合条件元素组成的新列表。 语法:filter(function, iterable) 参数:function(判断函数),iterable (可迭代对象) 返回值: Python 2.x 返回列表 Python
阅读全文
摘要:一、前言 在我们在使用python进行编码的时候,写出高质量性能好的代码是一个比较好的习惯,line_profiler可很好的帮助我们 二、安装 1、下载 下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#line_profiler 下载想要安装的版本
阅读全文