随笔分类 - python
摘要:题目 给定两个大小为 m 和 n 的有序数组 nums1 和 nums2。 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。 你可以假设 nums1 和 nums2 不会同时为空。 示例 1: nums1 = [1, 3] nums2 = [2] 则中位数是 
        阅读全文
            
摘要:问题 地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] 。一个机器人从坐标 [0, 0] 的格子开始移动,它每次可以向左、右、上、下移动一格(不能移动到方格外),也不能进入行坐标和列坐标的数位之和大于k的格子。例如,当k为18时,机器人能够进入方格 [35, 37] ,因为3
        阅读全文
            
摘要:问题 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 示例 1: 输入: "babad" 输出: "bab" 注意: "aba" 也是一个有效答案。 示例 2: 输入: "cbbd" 输出: "bb" code #!/usr/bin/python3 # -*
        阅读全文
            
摘要:code S = 'xxxabcxxxxabcxxabcxxabc' search="xxxa" last_cur=0 count=0 while(1): where=S.find(search) if(not where 1): print(last_cur+where) S=S[where+le
        阅读全文
            
摘要:code https://docs.python.org/zh-cn/3.7/using/mac.html
        阅读全文
            
摘要:code >>> import os >>> dir, suffix = os.path.splitext("test.pdf") >>> dir 'test' >>> suffix '.pdf' >>> dir, suffix = os.path.splitext("/root/test.pdf"
        阅读全文
            
摘要:code import base64 import io import os from PIL import Image from PIL import ImageFile # 压缩图片文件 def compress_image(infile,outfile, mb=19, quality=3, k
        阅读全文
            
摘要:code import os from PIL import Image def get_size(file): # 获取文件大小:KB size = os.path.getsize(file) return int(size / 1024) def get_outfile(infile, outf
        阅读全文
            
摘要:code import os import cv2 def compress(dirname): for filename in os.listdir(dirname): f=os.path.join(dirname,filename) img=cv2.imread(f,2) cv2.imwrite
        阅读全文
            
摘要:ipython是一个python的交互式shell,比默认的python shell好用得多,支持变量自动补全,自动缩进,支持bash shell命令,内置了许多很有用的功能和函数。学习ipython将会让我们以一种更高的效率来使用python。同时它也是利用Python进行科学计算和交互可视化的一
        阅读全文
            
摘要:sqlite3 官网:https://www.sqlite.org/download.html 图片 code #更新SQLite 3 #获取源代码(在主目录中运行) [root@djangoServer ~]# cd ~ [root@djangoServer ~]# wget https://ww
        阅读全文
            
摘要:code Linux >>> import django >>> django.VERSION Windows python -m django --version
        阅读全文
            
摘要:解决方法1,给django降级 卸载django: pip uninstall django 安装低版本: pip install django==2.1.8 解决方法2,升级sqlite #更新SQLite 3 #获取源代码(在主目录中运行) [root@djangoServer ~]# cd ~
        阅读全文
            
摘要:解决方法 https://www.cnblogs.com/sea-stream/p/10388303.html
        阅读全文
            
摘要:code pip3 install requests
        阅读全文
            
摘要:code pip3 install bs4
        阅读全文
            
摘要:code bool(re.search(r'\d', str))
        阅读全文
            
摘要:code # 提供了两个列表,对相同位置的列表数据进行相加 >>> map(lambda x, y: x + y, [1, 3, 5, 7, 9], [2, 4, 6, 8, 10]) [3, 7, 11, 15, 19]
        阅读全文
            
摘要:code >>> l1=[1,2,3,4,5,6] >>> l2=[4,5,6,7,8,9] >>> print(dict(zip(l1,l2))) {1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9}
        阅读全文
            
摘要:这个问题导致的原因是我用的是同一个支付宝账号,也就是收款支付宝和付款支付宝一样的,所以才导致此问题出现了,这是低级错误,解决方法:退出该支付宝账号,重新换另一个支付宝账号,再尝试扫一扫支付,此问题便解决了
        阅读全文
            
 
                    
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号