随笔分类 -  python

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 25 下一页
python学习
摘要:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyexecjs import execjs 阅读全文
posted @ 2023-03-07 06:55 myrj 阅读(64) 评论(0) 推荐(0)
摘要:import pandas as pd from pandas.io.stata import StataReader, StataWriter file="cfps2020famconf_202301.dta" stata_data = StataReader(file, convert_cate 阅读全文
posted @ 2023-03-04 11:34 myrj 阅读(93) 评论(0) 推荐(0)
摘要:import pandas as pd data = pd.read_stata('cfps2020famconf_202301.dta') data.to_stata('output_file.dta') data.to_stata('output_file.dta', version=12) # 阅读全文
posted @ 2023-03-04 11:15 myrj 阅读(280) 评论(0) 推荐(0)
摘要:from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher ModuleNotFoundError: No module named 'Crypto' 解决方法: pip install pycryptodome 阅读全文
posted @ 2023-03-04 09:15 myrj 阅读(1284) 评论(0) 推荐(0)
摘要:www.pythonthree.compytubePytube 是一个小型的、无依赖性的 Python 模块,用于从 Internet 访问视频,必须先安装它才能使用它。当你有 pip 时,安装很简单。要使用 pip 安装 Pytube,您需要以管理员身份打开命令提示符 CLI 并输入以下命令: p 阅读全文
posted @ 2023-02-20 13:53 myrj 阅读(30) 评论(0) 推荐(0)
摘要:Python使用requests時遇到Failed to establish a new connection解决方法:但是程式邏輯的關係我會在短時間使用多次requests.post其結果就是跳出了Failed to establish a new connection這樣一個錯誤google一下 阅读全文
posted @ 2023-02-07 08:51 myrj 阅读(1322) 评论(0) 推荐(0)
摘要:import urllib3urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) #忽略警告 aa=requests.post(url,headers=head1,data=ap1,verify=False) 阅读全文
posted @ 2023-01-26 22:52 myrj 阅读(370) 评论(0) 推荐(0)
摘要:import os def get_size(start_path = '.'): total_size = 0 for dirpath, dirnames, filenames in os.walk(start_path): for f in filenames: fp = os.path.joi 阅读全文
posted @ 2023-01-13 05:50 myrj 阅读(131) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python # encoding: utf-8 import requests, os, platform, time from Crypto.Cipher import AES import multiprocessing from retrying import 阅读全文
posted @ 2022-12-28 18:18 myrj 阅读(307) 评论(0) 推荐(0)
摘要:import signal def tt(signum, frame): print('You choose to stop me.') exit() signal.signal(signal.SIGINT, tt) signal.signal(signal.SIGTERM, tt) while 1 阅读全文
posted @ 2022-12-27 09:46 myrj 阅读(69) 评论(0) 推荐(0)
摘要:from wxauto import WeChat import pywinauto,time,sys,re,random # 获取当前微信客户端 wx = WeChat() # 获取会话列表 wx.GetSessionList() # 输出当前聊天窗口聊天消息 ##msgs = wx.GetAll 阅读全文
posted @ 2022-12-26 16:33 myrj 阅读(462) 评论(0) 推荐(0)
摘要:re.error: unterminated character set at position 12 这很可能是因为元字符“{}、[]、()”。有没有什么正则表达式可以让finditer忽略它? 您必须转义正则表达式中的特殊字符: slice = "this characters \{}, \[] 阅读全文
posted @ 2022-12-26 13:33 myrj 阅读(4013) 评论(0) 推荐(0)
摘要:检测文件大小: os.path.getsize(filepath) 阅读全文
posted @ 2022-12-23 16:02 myrj 阅读(16) 评论(0) 推荐(0)
摘要:>>> aa="abcdde">>> aa.zfill(10)'0000abcdde'>>> aa.zfill(2)'abcdde'>>> aa.zfill(6)'abcdde'>>> aa.rjust(10,"*")'****abcdde'>>> ab="-100.24">>> ab.zfill( 阅读全文
posted @ 2022-12-23 15:53 myrj 阅读(149) 评论(0) 推荐(0)
摘要:##for 临时变量 in 序列: ## 重复执行的代码 ## ...... ##else: ## 循环正常结束后要执行的代码 #所谓else指的是循环正常结束后要执行的代码,即如果是bresk终止循环的情况。 #else下方缩进的代码将不执行。 #Break是终止循环,一旦遇到break就代表循环 阅读全文
posted @ 2022-12-12 06:44 myrj 阅读(85) 评论(0) 推荐(0)
摘要:>>> import ast >>> aar='{"ab":1,"ac":2,"ad":3}' >>> aaxx=ast.literal_eval(aar) >>> aaxx {'ab': 1, 'ac': 2, 'ad': 3} >>> >>> aar='{"ab":1,"ac":2,"ad":3 阅读全文
posted @ 2022-12-11 15:38 myrj 阅读(32) 评论(0) 推荐(0)
摘要:import threading sem = threading.Semaphore(10)#设置最大线程数 #在线程调用的函数开始设置sem.acquire() #在线程调用的函数最后设置sem.release() def xiazai(iiv,chapter_url_list): sem.acq 阅读全文
posted @ 2022-12-09 21:51 myrj 阅读(451) 评论(0) 推荐(0)
摘要:import requests,time,datetime,os,sys,re,random,string,json,pymysql import configparser,multiprocessing from multiprocessing import Process,Lock,Manage 阅读全文
posted @ 2022-11-30 14:27 myrj 阅读(63) 评论(0) 推荐(0)
摘要:>>> ac="mmjj" >>> aaa="adfbvbad{}".format(ac) >>> aaa 'adfbvbadmmjj' >>> aaa="adfbvbad{}aaa{}".format(ac) Traceback (most recent call last): File "<py 阅读全文
posted @ 2022-11-27 09:41 myrj 阅读(152) 评论(0) 推荐(0)
摘要:import urllib#汉字转编码aa=urllib.parse.quote("郭城峰".encode('gb2312'))#编码是GB2312print(aa)aa=urllib.parse.quote("格力塔扇".encode('gb2312'))print(aa) aa=urllib.p 阅读全文
posted @ 2022-11-27 08:54 myrj 阅读(503) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 25 下一页