- 博客(14)
- 资源 (1)
- 收藏
- 关注
原创 requests请求网页乱码解决
url = 'https://www.cannews.com.cn/2022/0218/338821.shtml' r = requests.get(url) r.encoding = r.apparent_encoding print(r.text)
2022-02-19 18:10:20
1246
原创 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
532
原创 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
813
原创 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
5127
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
696
原创 ffmpeg-4.3对音频文件进行拼接
from scipy.io import wavfile import numpy as np from os import listdir from ffmpy import FFmpeg as mpy import os import shutil class ConbineSound(object): """docstring for ConbineSound""" def __init__(self,saveName): super(ConbineSound, .
2022-02-16 15:02:45
3129
原创 python调用百度文字转语音api
from aip import AipSpeech import os import shutil class 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
1927
原创 python实现语音转文字(百度接口)
import json import base64 import os import requests RATE = "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
3377
2
原创 pyaudio音频录制
pyaudio模块调用麦克风进行音频录制 // An highlighted block import wave from pyaudio import PyAudio,paInt16 framerate=16000 NUM_SAMPLES=2000 channels=1 sampwidth=2 TIME=3 def save_wave_file(data): '''save the date to the wavfile''' filename = "./static/yuyin/re
2022-02-16 14:33:51
425
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅