文章分类 - python
摘要:1、新建包取名字 2、在文件夹里新建python文件命名 3、在init文件里写上form . import 名字
阅读全文
摘要:def download_img(img_url,name): request = urllib.request.Request(img_url) try: response = urllib.request.urlopen(request) img_name = name+".png" filen
阅读全文
摘要:import reurl = '//172.22.68.102/FineWeatherForecastData/ForecastWord/省台/20201115/2020111505.txt' # f2 = open(url, "r", encoding='ansi')file = open(url
阅读全文
摘要:点terminal输入命令python manage.py startapp my_app(my_app就是项目名)点回车 python manage.py startapp my_app 1、在settings.py中设置INSTALLED_APPS = [ 'django.contrib.adm
阅读全文
摘要:1、在urls.py写path('webApi/GetExpress/', views.get_ExpressNews), 2、在view.pydef get_ExpressNews(request): ctx={ 'TyphoonDynamic': '台风动态', 'Sea':'26日白天到28日
阅读全文
摘要:import osprint os.getcwd() #获取当前工作目录路径print os.path.abspath('.') #获取当前工作目录路径print os.path.abspath('test.txt') #获取当前目录文件下的工作目录路径print os.path.abspath('
阅读全文
摘要:import os def del_file(): try: os.remove("E:\\333.docx") print("文件删除完毕") except(FileNotFoundError): print("文件不存在")
阅读全文
摘要:C:\Users\lin\AppData\Local\Programs\Python\Python37
阅读全文
摘要:from django.conf.urls import urlfrom django.contrib import adminfrom django.urls import pathfrom . import views urlpatterns = [ url(r'^$', views.hello
阅读全文
摘要:try: except : ctx = obj.ExpressNews() return myhttp.retrun_rest(ctx) try: buff = myhttp.retruntext(filename) except IOError: buff = ''
阅读全文
摘要:from django.http import HttpResponseimport jsondef test(request): result = {"result": 0, "msg": "执行成功"} #json返回为中文 return HttpResponse(json.dumps(resu
阅读全文
摘要:0:35:57net use \\172.22.68.102\FineWeatherForecastData "qxtserver" /user:qxt 0:37:28net use * /del /y
阅读全文
摘要:data={"aa":5} if data.get('aa'): print(data['aa']) elif 条件2: 条件2不满足时做的事情1 条件2不满足时做的事情2 条件2不满足时做的事情3 。。。。。。等等
阅读全文
摘要:python 实现下标循环Python内置的enumerate函数可以把一个list变成索引-元素对,这样就可以在for循环中同时迭代索引和元素本身: >>> for i, value in enumerate(['A', 'B', 'C']):... print(i, value)...0 A1
阅读全文
浙公网安备 33010602011771号