- 博客(14)
- 资源 (1)
- 收藏
- 关注
原创 requests请求网页乱码解决
url = 'https://www.cannews.com.cn/2022/0218/338821.shtml'r = requests.get(url)r.encoding = r.apparent_encodingprint(r.text)
2022-02-19 18:10:20
1156
原创 django文件的上传下载
文件的上传def upload(request): file = request.FILES.get('file-data') with open(filename, 'wb+') as f: for chunk in file.chunks(): f.write(chunk) f.close() context['msg'] = '上传成功!' return HttpResponse(json.dumps(con
2022-02-16 15:46:52
443
原创 django的登陆认证装饰器
import functools#装饰器,用于认证用户是否登陆def user_logging(func): @functools.wraps(func) def deco(*args,**kwargs): user_id = args[0].COOKIES.get('user_id') if user_id: user = User.objects.filter(id = user_id).first() args[0].con.
2022-02-16 15:40:50
690
原创 echarts中国地图(百度地图)
<script> var myChart = echarts.init(document.getElementById('map')); var data1 = {{map|safe}};var geoCoordMap = { 海门: [121.15, 31.89], 鄂尔多斯: [109.781327, 39.608266], 招远: [120.38, 37.35], 舟山: [122.207216, 29.985295], 齐齐哈尔: [123.97,.
2022-02-16 15:31:31
4718
1
转载 ajax基本格式
$.ajax({ url:'',//接口地址 type:'POST',//传值方式 data:'',//需要提供的参数 success:function(res){ //成功后需要进行的操作 } })或者$.ajax({ url:"http://www.test.com", //请求的url地址 dataType:"json", //返回格式为json asy.
2022-02-16 15:22:33
598
原创 ffmpeg-4.3对音频文件进行拼接
from scipy.io import wavfileimport numpy as npfrom os import listdirfrom ffmpy import FFmpeg as mpyimport osimport shutilclass ConbineSound(object): """docstring for ConbineSound""" def __init__(self,saveName): super(ConbineSound, .
2022-02-16 15:02:45
2951
原创 python调用百度文字转语音api
from aip import AipSpeechimport osimport shutilclass getMp3(object): """docstring for getMp3""" def __init__(self): super(getMp3, self).__init__() self.APP_ID = '25602943' self.API_KEY = 'vyYLov63W6x33nIPvwVdLLsX' .
2022-02-16 14:55:43
1749
原创 python实现语音转文字(百度接口)
import jsonimport base64import osimport requestsRATE = "16000"FORMAT = "wav"CUID="wate_play"DEV_PID="1536"def get_token(): server = "https://openapi.baidu.com/oauth/2.0/token?" grant_type = "client_credentials" #API Key client_i.
2022-02-16 14:48:56
3175
2
原创 pyaudio音频录制
pyaudio模块调用麦克风进行音频录制// An highlighted blockimport wavefrom pyaudio import PyAudio,paInt16framerate=16000NUM_SAMPLES=2000channels=1sampwidth=2TIME=3def save_wave_file(data): '''save the date to the wavfile''' filename = "./static/yuyin/re
2022-02-16 14:33:51
328
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人