python
林永奇
这个作者很懒,什么都没留下…
展开
-
linux
ubuntu使用xshell教程(1):apt-get install openssh-serverssh ip 就可以了原创 2021-02-06 15:10:24 · 112 阅读 · 1 评论 -
NumPy数值计算基础
import numpy as np arr=np.array([1,2,3,4,5,6]) print("arr:",arr) print("arr.维度",arr.ndim) print("arr:形状",arr.shape) print("arr:大小",arr.size) print("arr:数据类型",arr.dtype) print("a...原创 2019-06-14 19:42:25 · 400 阅读 · 0 评论 -
xpath爬取安居客数据并保存数据库
import requestsfrom lxml import etreeimport pymysqlfrom fake_useragent import UserAgentclass AnJuKe: def __init__(self): self.count = 1 #计数 self.get_html() #一定要记得调用函数 ...原创 2019-03-24 22:10:33 · 953 阅读 · 0 评论 -
python---互亿--短信验证
**import requests** #引入此模块url = "http://106.ihuyi.com/webservice/sms.php?method=Submit" #请求地址mobile='此处填注册的手机号码' #注意是字符串类型account="此处填APIID"password="此处填APIKEY"header = {'Content-ty..原创 2019-03-12 21:18:47 · 255 阅读 · 0 评论 -
python中 “is” 和 "=="的区别----内存地址的深入理解
直接上手撸代码我们先看一段(字符串情况):a=“hello world”b=“hello world”打印出结果:print(id(a)) #5619056print(id(b)) #5619056print(a is b) #Trueprint(a==b) #True(列表的情况)c=[1,2,3]d=[1,2,3]print(id(c)) #19029...原创 2019-03-16 15:18:59 · 589 阅读 · 0 评论 -
python----对折查找
a=[i for i in range(1,10000)]num =int (input(“请输入一个数:”))low=0high=len(a)-1while low<=high:mid=(low+high)//2if num>a[mid]:low=mid+1elif num<a[mid]:high=mid-1else:print(num,“的下标是%d”%...原创 2019-03-11 18:25:35 · 273 阅读 · 0 评论 -
python-----观察者模式
class Resi():def init(self):self.obsers=[]self.staus=’’def attach(self,observe):self.obsers.append(observe)def notify(self):for obj in self.obsers:obj.update()class Observe():def init(self,n...原创 2019-03-11 18:24:05 · 186 阅读 · 0 评论 -
python----策略模式
策略模式class CashNormal():def accept_money(self,money):return moneyclass CashRate():def init(self,rate):self.rate=ratedef accept_money(self,money):return money*self.rateclass CashReturn():def i...原创 2019-03-11 18:22:51 · 146 阅读 · 0 评论 -
视图类
from django.shortcuts import render, HttpResponsefrom app import modelsCreate your views here.from django.views import Viewclass Login(View):def get(self, request):return render(request, ‘login....原创 2019-03-11 12:33:15 · 150 阅读 · 0 评论 -
django-url反向代理
Title点我进index2from django.urls import path,include,re_pathfrom app import viewsurlpatterns = [re_path(r'^index/$',views.index,),re_path(r'^index2/$',views.index2,name='aa')]f...原创 2019-03-11 12:31:42 · 504 阅读 · 0 评论 -
django ----orm--一对多,多对多
Create your views here.from django.shortcuts import renderfrom app import modelsCreate your views here.def index(request):# student_obj=models.Student.objects.get(name=‘周星驰’)# sub_obj=student_ob...原创 2019-03-11 12:26:51 · 169 阅读 · 0 评论 -
django---cookie解析
from app import modelsCreate your views here.def success(request):username=request.COOKIES.get(‘name’)pwd=request.COOKIES.get(‘pwd’)user_list = models.User.objects.filter(name=username, pwd=pwd)...原创 2019-03-11 12:23:43 · 281 阅读 · 0 评论