python-爬虫初识-采集汽车资讯信息案例(一)

2023-11-17

目录

一,什么是爬虫

二,初识爬虫-采集汽车资讯信息

三,requests和BeautifulSoup模块基本使用

requests: import requests

BeautifulSoup:from bs4 import BeautifulSoup

四,初识爬虫-自动登录购酒网http://order.gjw.com/login/login

五,requests模块详细介绍

六,一大波"自动登陆"示例


一,什么是爬虫

     很久很久以前,还没有"百度","谷歌",有的还是传说中的"大黄页",如果想要上网查找一些东西....需要记住这些东西的"域名".....越来越多....想要查找这些"域名",在"大黄页"上太费劲。然后就出现了做 "搜索引擎" 的一批人.... 这就出现了像 "百度"...等等这些...在网络上抓取所有的''网页"。 

     这些"网页",等网络上的信息,这么收录到百度,这就是 爬虫, 爬虫:自动化的应用程序。分为:定向和非定向的。像"百度" 就是非定向的,什么都要爬取。

二,初识爬虫-采集汽车资讯信息

    采集汽车资讯信息- 实际生活中有某些"公司"也在使用,比如"某公司"是做汽车业务的,包括很多,比如 汽车报价...等等, 这些公司的首页有大量的“资讯文章”,由于这些公司没有编辑,文章都是通过 爬虫 到各大网站爬取到这些资讯文章,然后稍加修改,通过运营后台去把这些文章展示为自己的文章.... 

代码步骤如下-爬取汽车资讯图片(第一版):

import requests
from bs4 import BeautifulSoup

# 1,拉取页面
response = requests.get('https://www.autohome.com.cn/news/')
# 2,编码
response.encoding = response.apparent_encoding
# 3,获取文本
# print(response.text)
# 4,将文本转换为html文本对象
soup = BeautifulSoup(response.text, features='html.parser')
# 5,获取id为"XXX"的html文本
target = soup.find(id='auto-channel-lazyload-article')
# 6,获取target中所有的 <li>标签列表
li_list = target.findAll('li')
# print(li_list)
# 7,获取<li>中所有的<a>
for i in li_list:
    a = i.find('a')
    if a:
        # 获取所有<a>标签href属性值
        print(a.attrs.get('href'))
        # 获取文章标题 对象类型-<bs4.element.Tag>
        txt = a.find('h3')
        txt = a.find('h3').text
        print(txt)
        # 获取<img>标签src属性
        img = a.find('img')
        img_url = img.attrs.get('src').strip("http://")
        print(img_url)
        img_url = 'http://' + img_url
        # 获取图片
        img_response = requests.get(url=img_url)
        import uuid
        # 将图片写入本地
        # file_name = str(uuid.uuid4()) + '.jpg'
        path = 'C:\\Users\\xxxxx\\Desktop\\skin\\%s.gif' % (str(uuid.uuid4()))
        with open(path, 'wb') as f:
            f.write(img_response.content)

三,requests和BeautifulSoup模块基本使用

requests: import requests

response = requests.get('URL') # 发生get请求

response.text #文本

response.content #内容

response.enocding #编码

response.aparent_encoding #编码

response.status_code #状态码

BeautifulSoup:from bs4 import BeautifulSoup

BeautifulSoup是一个模块,该模块用于接收一个HTML或XML字符串,然后将其进行格式化,之后遍可以使用他提供的方法进行快速查找指定元素,从而使得在HTML或XML中查找指定元素变得简单。

suop=BeautifulSoup(response.text, features='html.parser') #将文本转换为html对象,处理引擎 features 默认为 html.parser

suop.find('div') # 获取suop子元素中第一个div元素

v2 = suop.findAll() # 获取所有子元素, 返回列表

obj = v2[0] #或者for in 循环获取里面的元素

obj.text

obj.attrs

四,初识爬虫-自动登录购酒网http://order.gjw.com/login/login

import requests
from bs4 import BeautifulSoup


# 1,发送登录请求 http://order.gjw.com/login/login
post_dict = {
    "txtPassword": '112233aassdd',
    "txtUserName": '13393406705',
}
response = requests.post('http://order.gjw.com/login/login', post_dict)
print(response.text)

get_dict = response.cookies.get_dict()  # 获取cookies
print(get_dict)

get = requests.get('http://order.gjw.com/UserCenter/MyOrder.html', cookies=get_dict)
print(get.text)

五,requests模块详细介绍

文档地址:

https://2.python-requests.org//zh_CN/latest/user/quickstart.html

request.get(...)

request.post(...)

request.put(....)

request.delete(...)

request.request("post/get",...)

- 常用参数

-method: 请求方式

-url:提交地址

-params:在url上传递的参数,get方式参数

-data: 请求体传递参数body,post方式参数

-json :请求体传递参数

-headers : 请求头

-cookies : Cookies

-高级参数

-files : 字典形式,文件上传参数

requests.post(
    url='xxx',
    files={
        'f1': open('s1.py', 'rb'),
        'f2': ('上传后的文件名', open('s1.py', 'rb'))
    }
)

-session :用于保存客户端历史访问信息.

-更多参数

def request(method, url, **kwargs):
    """Constructs and sends a :class:`Request <Request>`.

    :param method: method for the new :class:`Request` object.
    :param url: URL for the new :class:`Request` object.
    :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
    :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
    :param json: (optional) json data to send in the body of the :class:`Request`.
    :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
    :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
    :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
        ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
        or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
        defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
        to add for the file.
    :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
    :param timeout: (optional) How long to wait for the server to send data
        before giving up, as a float, or a :ref:`(connect timeout, read
        timeout) <timeouts>` tuple.
    :type timeout: float or tuple
    :param allow_redirects: (optional) Boolean. Set to True if POST/PUT/DELETE redirect following is allowed.
    :type allow_redirects: bool
    :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
    :param verify: (optional) whether the SSL cert will be verified. A CA_BUNDLE path can also be provided. Defaults to ``True``.
    :param stream: (optional) if ``False``, the response content will be immediately downloaded.
    :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
    :return: :class:`Response <Response>` object
    :rtype: requests.Response

    Usage::

      >>> import requests
      >>> req = requests.request('GET', 'http://httpbin.org/get')
      <Response [200]>
    """
def param_method_url():
    # requests.request(method='get', url='http://127.0.0.1:8000/test/')
    # requests.request(method='post', url='http://127.0.0.1:8000/test/')
    pass


def param_param():
    # - 可以是字典
    # - 可以是字符串
    # - 可以是字节(ascii编码以内)

    # requests.request(method='get',
    # url='http://127.0.0.1:8000/test/',
    # params={'k1': 'v1', 'k2': '水电费'})

    # requests.request(method='get',
    # url='http://127.0.0.1:8000/test/',
    # params="k1=v1&k2=水电费&k3=v3&k3=vv3")

    # requests.request(method='get',
    # url='http://127.0.0.1:8000/test/',
    # params=bytes("k1=v1&k2=k2&k3=v3&k3=vv3", encoding='utf8'))

    # 错误
    # requests.request(method='get',
    # url='http://127.0.0.1:8000/test/',
    # params=bytes("k1=v1&k2=水电费&k3=v3&k3=vv3", encoding='utf8'))
    pass


def param_data():
    # 可以是字典
    # 可以是字符串
    # 可以是字节
    # 可以是文件对象

    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # data={'k1': 'v1', 'k2': '水电费'})

    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # data="k1=v1; k2=v2; k3=v3; k3=v4"
    # )

    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # data="k1=v1;k2=v2;k3=v3;k3=v4",
    # headers={'Content-Type': 'application/x-www-form-urlencoded'}
    # )

    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # data=open('data_file.py', mode='r', encoding='utf-8'), # 文件内容是:k1=v1;k2=v2;k3=v3;k3=v4
    # headers={'Content-Type': 'application/x-www-form-urlencoded'}
    # )
    pass


def param_json():
    # 将json中对应的数据进行序列化成一个字符串,json.dumps(...)
    # 然后发送到服务器端的body中,并且Content-Type是 {'Content-Type': 'application/json'}
    requests.request(method='POST',
                     url='http://127.0.0.1:8000/test/',
                     json={'k1': 'v1', 'k2': '水电费'})


def param_headers():
    # 发送请求头到服务器端
    requests.request(method='POST',
                     url='http://127.0.0.1:8000/test/',
                     json={'k1': 'v1', 'k2': '水电费'},
                     headers={'Content-Type': 'application/x-www-form-urlencoded'}
                     )


def param_cookies():
    # 发送Cookie到服务器端
    requests.request(method='POST',
                     url='http://127.0.0.1:8000/test/',
                     data={'k1': 'v1', 'k2': 'v2'},
                     cookies={'cook1': 'value1'},
                     )
    # 也可以使用CookieJar(字典形式就是在此基础上封装)
    from http.cookiejar import CookieJar
    from http.cookiejar import Cookie

    obj = CookieJar()
    obj.set_cookie(Cookie(version=0, name='c1', value='v1', port=None, domain='', path='/', secure=False, expires=None,
                          discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False,
                          port_specified=False, domain_specified=False, domain_initial_dot=False, path_specified=False)
                   )
    requests.request(method='POST',
                     url='http://127.0.0.1:8000/test/',
                     data={'k1': 'v1', 'k2': 'v2'},
                     cookies=obj)


def param_files():
    # 发送文件
    # file_dict = {
    # 'f1': open('readme', 'rb')
    # }
    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # files=file_dict)

    # 发送文件,定制文件名
    # file_dict = {
    # 'f1': ('test.txt', open('readme', 'rb'))
    # }
    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # files=file_dict)

    # 发送文件,定制文件名
    # file_dict = {
    # 'f1': ('test.txt', "hahsfaksfa9kasdjflaksdjf")
    # }
    # requests.request(method='POST',
    # url='http://127.0.0.1:8000/test/',
    # files=file_dict)

    # 发送文件,定制文件名
    # file_dict = {
    #     'f1': ('test.txt', "hahsfaksfa9kasdjflaksdjf", 'application/text', {'k1': '0'})
    # }
    # requests.request(method='POST',
    #                  url='http://127.0.0.1:8000/test/',
    #                  files=file_dict)

    pass


def param_auth():
    from requests.auth import HTTPBasicAuth, HTTPDigestAuth

    ret = requests.get('https://api.github.com/user', auth=HTTPBasicAuth('wupeiqi', 'sdfasdfasdf'))
    print(ret.text)

    # ret = requests.get('http://192.168.1.1',
    # auth=HTTPBasicAuth('admin', 'admin'))
    # ret.encoding = 'gbk'
    # print(ret.text)

    # ret = requests.get('http://httpbin.org/digest-auth/auth/user/pass', auth=HTTPDigestAuth('user', 'pass'))
    # print(ret)
    #


def param_timeout():
    # ret = requests.get('http://google.com/', timeout=1)
    # print(ret)

    # ret = requests.get('http://google.com/', timeout=(5, 1))
    # print(ret)
    pass


def param_allow_redirects():
    ret = requests.get('http://127.0.0.1:8000/test/', allow_redirects=False)
    print(ret.text)


def param_proxies():
    # proxies = {
    # "http": "61.172.249.96:80",
    # "https": "http://61.185.219.126:3128",
    # }

    # proxies = {'http://10.20.1.128': 'http://10.10.1.10:5323'}

    # ret = requests.get("http://www.proxy360.cn/Proxy", proxies=proxies)
    # print(ret.headers)


    # from requests.auth import HTTPProxyAuth
    #
    # proxyDict = {
    # 'http': '77.75.105.165',
    # 'https': '77.75.105.165'
    # }
    # auth = HTTPProxyAuth('username', 'mypassword')
    #
    # r = requests.get("http://www.google.com", proxies=proxyDict, auth=auth)
    # print(r.text)

    pass


def param_stream():
    ret = requests.get('http://127.0.0.1:8000/test/', stream=True)
    print(ret.content)
    ret.close()

    # from contextlib import closing
    # with closing(requests.get('http://httpbin.org/get', stream=True)) as r:
    # # 在此处理响应。
    # for i in r.iter_content():
    # print(i)


def requests_session():
    import requests

    session = requests.Session()

    ### 1、首先登陆任何页面,获取cookie

    i1 = session.get(url="http://dig.chouti.com/help/service")

    ### 2、用户登陆,携带上一次的cookie,后台对cookie中的 gpsd 进行授权
    i2 = session.post(
        url="http://dig.chouti.com/login",
        data={
            'phone': "8615131255089",
            'password': "xxxxxx",
            'oneMonth': ""
        }
    )

    i3 = session.post(
        url="http://dig.chouti.com/link/vote?linksId=8589623",
    )
    print(i3.text)

参数示例

六,一大波"自动登陆"示例

1.github

#!/usr/bin/env python
# -*- coding:utf-8 -*-

import requests
from bs4 import BeautifulSoup

# ############## 方式一 ##############
#
# # 1. 访问登陆页面,获取 authenticity_token
# i1 = requests.get('https://github.com/login')
# soup1 = BeautifulSoup(i1.text, features='lxml')
# tag = soup1.find(name='input', attrs={'name': 'authenticity_token'})
# authenticity_token = tag.get('value')
# c1 = i1.cookies.get_dict()
# i1.close()
#
# # 1. 携带authenticity_token和用户名密码等信息,发送用户验证
# form_data = {
# "authenticity_token": authenticity_token,
#     "utf8": "",
#     "commit": "Sign in",
#     "login": "xxxx@live.com",
#     'password': 'xxoo'
# }
#
# i2 = requests.post('https://github.com/session', data=form_data, cookies=c1)
# c2 = i2.cookies.get_dict()
# c1.update(c2)
# i3 = requests.get('https://github.com/settings/repositories', cookies=c1)
#
# soup3 = BeautifulSoup(i3.text, features='lxml')
# list_group = soup3.find(name='div', class_='listgroup')
#
# from bs4.element import Tag
#
# for child in list_group.children:
#     if isinstance(child, Tag):
#         project_tag = child.find(name='a', class_='mr-1')
#         size_tag = child.find(name='small')
#         temp = "项目:%s(%s); 项目路径:%s" % (project_tag.get('href'), size_tag.string, project_tag.string, )
#         print(temp)



# ############## 方式二 ##############
# session = requests.Session()
# # 1. 访问登陆页面,获取 authenticity_token
# i1 = session.get('https://github.com/login')
# soup1 = BeautifulSoup(i1.text, features='lxml')
# tag = soup1.find(name='input', attrs={'name': 'authenticity_token'})
# authenticity_token = tag.get('value')
# c1 = i1.cookies.get_dict()
# i1.close()
#
# # 1. 携带authenticity_token和用户名密码等信息,发送用户验证
# form_data = {
#     "authenticity_token": authenticity_token,
#     "utf8": "",
#     "commit": "Sign in",
#     "login": "xxxx@live.com",
#     'password': 'xxoo'
# }
#
# i2 = session.post('https://github.com/session', data=form_data)
# c2 = i2.cookies.get_dict()
# c1.update(c2)
# i3 = session.get('https://github.com/settings/repositories')
#
# soup3 = BeautifulSoup(i3.text, features='lxml')
# list_group = soup3.find(name='div', class_='listgroup')
#
# from bs4.element import Tag
#
# for child in list_group.children:
#     if isinstance(child, Tag):
#         project_tag = child.find(name='a', class_='mr-1')
#         size_tag = child.find(name='small')
#         temp = "项目:%s(%s); 项目路径:%s" % (project_tag.get('href'), size_tag.string, project_tag.string, )
#         print(temp)

github

2,知乎

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time

import requests
from bs4 import BeautifulSoup

session = requests.Session()

i1 = session.get(
    url='https://www.zhihu.com/#signin',
    headers={
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
    }
)

soup1 = BeautifulSoup(i1.text, 'lxml')
xsrf_tag = soup1.find(name='input', attrs={'name': '_xsrf'})
xsrf = xsrf_tag.get('value')

current_time = time.time()
i2 = session.get(
    url='https://www.zhihu.com/captcha.gif',
    params={'r': current_time, 'type': 'login'},
    headers={
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
    })

with open('zhihu.gif', 'wb') as f:
    f.write(i2.content)

captcha = input('请打开zhihu.gif文件,查看并输入验证码:')
form_data = {
    "_xsrf": xsrf,
    'password': 'xxooxxoo',
    "captcha": 'captcha',
    'email': '424662508@qq.com'
}
i3 = session.post(
    url='https://www.zhihu.com/login/email',
    data=form_data,
    headers={
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
    }
)

i4 = session.get(
    url='https://www.zhihu.com/settings/profile',
    headers={
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36',
    }
)

soup4 = BeautifulSoup(i4.text, 'lxml')
tag = soup4.find(id='rename-section')
nick_name = tag.find('span',class_='name').string
print(nick_name)

知乎

3,博客园

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
import json
import base64

import rsa
import requests


def js_encrypt(text):
    b64der = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCp0wHYbg/NOPO3nzMD3dndwS0MccuMeXCHgVlGOoYyFwLdS24Im2e7YyhB0wrUsyYf0/nhzCzBK8ZC9eCWqd0aHbdgOQT6CuFQBMjbyGYvlVYU2ZP7kG9Ft6YV6oc9ambuO7nPZh+bvXH0zDKfi02prknrScAKC0XhadTHT3Al0QIDAQAB'
    der = base64.standard_b64decode(b64der)

    pk = rsa.PublicKey.load_pkcs1_openssl_der(der)
    v1 = rsa.encrypt(bytes(text, 'utf8'), pk)
    value = base64.encodebytes(v1).replace(b'\n', b'')
    value = value.decode('utf8')

    return value


session = requests.Session()

i1 = session.get('https://passport.cnblogs.com/user/signin')
rep = re.compile("'VerificationToken': '(.*)'")
v = re.search(rep, i1.text)
verification_token = v.group(1)

form_data = {
    'input1': js_encrypt('wptawy'),
    'input2': js_encrypt('asdfasdf'),
    'remember': False
}

i2 = session.post(url='https://passport.cnblogs.com/user/signin',
                  data=json.dumps(form_data),
                  headers={
                      'Content-Type': 'application/json; charset=UTF-8',
                      'X-Requested-With': 'XMLHttpRequest',
                      'VerificationToken': verification_token}
                  )

i3 = session.get(url='https://i.cnblogs.com/EditDiary.aspx')

print(i3.text)

博客园

4,拉个网

#!/usr/bin/env python
# -*- coding:utf-8 -*-

import requests


# 第一步:访问登陆页,拿到X_Anti_Forge_Token,X_Anti_Forge_Code
# 1、请求url:https://passport.lagou.com/login/login.html
# 2、请求方法:GET
# 3、请求头:
#    User-agent
r1 = requests.get('https://passport.lagou.com/login/login.html',
                 headers={
                     'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
                 },
                 )

X_Anti_Forge_Token = re.findall("X_Anti_Forge_Token = '(.*?)'", r1.text, re.S)[0]
X_Anti_Forge_Code = re.findall("X_Anti_Forge_Code = '(.*?)'", r1.text, re.S)[0]
print(X_Anti_Forge_Token, X_Anti_Forge_Code)
# print(r1.cookies.get_dict())
# 第二步:登陆
# 1、请求url:https://passport.lagou.com/login/login.json
# 2、请求方法:POST
# 3、请求头:
#    cookie
#    User-agent
#    Referer:https://passport.lagou.com/login/login.html
#    X-Anit-Forge-Code:53165984
#    X-Anit-Forge-Token:3b6a2f62-80f0-428b-8efb-ef72fc100d78
#    X-Requested-With:XMLHttpRequest
# 4、请求体:
# isValidate:true
# username:15131252215
# password:ab18d270d7126ea65915c50288c22c0d
# request_form_verifyCode:''
# submit:''
r2 = requests.post(
    'https://passport.lagou.com/login/login.json',
    headers={
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36',
        'Referer': 'https://passport.lagou.com/login/login.html',
        'X-Anit-Forge-Code': X_Anti_Forge_Code,
        'X-Anit-Forge-Token': X_Anti_Forge_Token,
        'X-Requested-With': 'XMLHttpRequest'
    },
    data={
        "isValidate": True,
        'username': '15131255089',
        'password': 'ab18d270d7126ea65915c50288c22c0d',
        'request_form_verifyCode': '',
        'submit': ''
    },
    cookies=r1.cookies.get_dict()
)
print(r2.text)

拉勾网

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python-爬虫初识-采集汽车资讯信息案例(一) 的相关文章

  • Apache相关的几个安全漏洞修复

    最近网站被扫描出几个漏洞 大部分都是apache配置引起的 在此记录一下怎么修复 1 检测到目标URL存在http host头攻击漏洞 头攻击漏洞 比较常见的漏洞 修复的方法也提供了 漏洞的详细描述 为了方便的获得网站域名 开发人员一般依赖
  • 轻松调试线上的app之抓包工具stream

    痛点 对于一个线上app 是不是会因为无法调试而痛苦不堪 今天就给大家介绍一款好用的ios抓包应用 安装 1 在appstore中搜索stream 直接下载 2 打开软件 设置https抓包 对于https我们需要安装一下证书 具体原因可以
  • Android基础面试常常死在这几个问题上,移动架构师成长路线

    近日一好友去阿里面试 面试失败了 分享了一个他最不擅长的算法面试题 题目是这样的 题目 给定一个二叉搜索树 BST 找到树中第 K 小的节点 出题人 阿里巴巴出题专家 文景 阿里云 CDN 资深技术专家 参考答案 考察点 基础数据结构的理解
  • java socket——心跳包

    首先先说说心跳包在socket连接中的意义 通过socket连接的双方为了保证在一段时间未发消息不被防火墙断开连接或者使对方及时知道自己是否已经断线而定期给对方发送的某些特殊标识字符 这个字符可以根据双方自定义 没有实际的通讯意义 而定制的
  • 前奏

    上期我们一起学了CNN中四种常用的卷积操作 如下链接 CNN中常用的四种卷积详解 从这期开始 我们开始步入目标检测领域的大门 开始逐步一层一层的揭开目标检测的面纱 路要一步一步的走 字得一个一个的码 步子不能跨太大 太大容易那个啥 字也不能
  • Appnium下载及安装

    Appnium官方访问地址为 http appium io 可访问查看关于Appnium的相关资料 根据官网提供的安装步骤 gt brew install node get node js gt npm install g appium g
  • 预览图片pdf等文件

    文件下载直接返回流即可 但是如果返回图片pdf等 不想下载只想预览下 即可以设置不同的头 返回不同的预览流 文件预览 param bucketName 桶名称 param request 请求 param response 请求响应 pub
  • 2023华为OD机试真题Java实现【篮球比赛/深度优先搜索】【2023.Q2】

    题目内容 在篮球比赛中 每个队员的实力不通 队伍的实力计算方式为所有球员战斗力之和为该队伍的总体战斗力 篮球队员的总人数为10 他们分成两个队伍 教练希望2个队伍的战斗力差值能够尽可能的小 请你帮他实现目标 给出10个球员的战斗力 如果你是
  • 【华为OD机试】导师请吃火锅【2023 B卷

    华为OD机试 真题 点这里 华为OD机试 真题考点分类 点这里 题目描述 入职后 导师会请你吃饭 你选择了火锅 火锅里会在不同时间下很多菜 不同食材要煮不同的时间 才能变得刚好合适 你希望吃到最多的刚好合适的菜 但你的手速不够快 用m代表手
  • uniapp项目中防止用户重复提交

    1 在根目录下新建common文件并创建common js文件 代码直接复制粘贴即可 防止处理多次点击 function noMultipleClicks methods info methods是需要点击后需要执行的函数 info是点击需
  • CE认证EMC指令测试项及测试内容(智能开关)

    目录 发射 EMISSiON 1 交流电源端口传导发射Conducted Emissions from the AC mains power ports 2 辐射发射Radiated Emissions 3 谐波电流Harmonic Cur
  • SpringBoot项目中常见的参数传输方式

    传参方式 例子 请求方式 获取参数方式 说明 query 传统方式 getUser id 1 get和post 选用 RequestParam PathParam 路径传参 使用实体类 path REST风格 user 1 get和post
  • 【Redis】分布式锁

    Redis分布式锁 问题描述 随着业务发展的需要 原单体单机部署的系统被演化成分布式集群系统后 由于分布式系统多线程 多进程并且分布在不同机器上 这将使原单机部署情况下的并发控制锁策略失效 单纯的Java API并不能提供分布式锁的能力 为
  • Matlab多维数组漫谈教程

    MATLAB是一种强大的科学计算和数据分析工具 它支持多维数组操作 这使得它在处理复杂数据和矩阵计算方面非常出色 本文将详细介绍MATLAB中的多维数组以及如何使用它们进行各种操作 首先 我们需要了解多维数组的概念 多维数组是一个由元素组成
  • [从零开始学DeepFaceLab-2]: 使用-Windows可执行工具的下载、解压

    目录 前言 第1步 登录github官网 第2步 找到可执行程序下载入口
  • ElasticSearch安装在Windows上详细教程

    ElasticSearchWindows安装教程 Download Elasticsearch Elastic 解压ElasticSearch 打开elasticsearch 6 4 2 bin调用黑窗口 输入elasticsearch b
  • 给定一个字符串 s ,通过将字符串 s 中的每个字母转变大小写,我们可以获得一个新的字符串。返回 所有可能得到的字符串集合 。以 任意顺序 返回输出。

    class Solution public vector
  • 2023第五届CCPC河南省赛

    2023第五届CCPC河南省赛经历和题解 题目链接 榜单 经历 算法生涯第一场比赛正好是三年以来第一次线下省赛 因为学校不报销 QAQ 我和我们班两个同学三个大一一队跟着学长学姐一队一起自费趁着周六日假期从洛阳跑到郑州打比赛 周六晚上六点十

随机推荐

  • android项目迁移到androidX:类映射(android.support.v4*)

    支持库类 AndroidX 类 android support v4 accessibilityservice AccessibilityServiceInfoCompat androidx core accessibilityservic
  • 开源库uthash第三弹utstack.h

    文章目录 一 简介 1 1 介绍 1 2 源码获取 二 使用方法 2 1 栈头声明 2 2 栈操作 2 3 一个简单的实例 2 4 其他宏 一 简介 1 1 介绍 utstack h中包含了一组动态stack宏 使用起来非常简单 只需要将u
  • BUUCTF 之 [极客大挑战 2019] Havefun(GET 传参)

    BUUCTF 之 极客大挑战 2019 Havefun GET 传参 相关 题解 相关 项目 内容 难度 简单 类型 WEB 靶场 BUUCTF 坐标 Havefun 题解 启动靶机后 映入眼帘的是一只猫 网站首页没有按钮 提示信息等等 遇
  • $(window).load(function() {})和$(document).ready(function(){})的区别

    在我以前的开发中 一般用到javascript 我都是采用jquery的模式 也就是大多数时候 第一行写的是 document ready function 这个时候 不一定要等所有的js和图片加载完毕 就可以执行一些方法 不过有些时候 必
  • STM32 USB Mass Storage 例程调试笔记

    一 问题起因 近来有几个客户反映STM3210E的开发板的USB Mass Storage 例程有点问题 组长安排我来调试 Mass Storage例程在PC上实现两个U盘 一个是SD盘 一个是NAND Flash盘 把程序下载到开发板后
  • [人工智能-深度学习-17]:神经网络基础 - 优化算法的本质是盲人探路或迷雾探险

    作者主页 文火冰糖的硅基工坊 文火冰糖 王文兵 的博客 文火冰糖的硅基工坊 CSDN博客 本文网址 https blog csdn net HiWangWenBing article details 120591591 目录 第1章 los
  • 使用PHPMailer发送邮件

    设置邮箱 所有的主流邮箱都支持 SMTP 协议 但并非所有邮箱都默认开启 您可以在邮箱的设置里面手动开启 第三方服务在提供了账号和密码之后就可以登录 SMTP 服务器 通过它来控制邮件的中转方式 SMTP 服务器认证密码 需要妥善保管 加载
  • 常见(但不常见)单子

    上周 我们研究了monad如何帮助您实现Haskell开发的下一个跃进 我们讨论了runXXXT模式 以及如何使用其余代码中的某些monad作为通用网关 但是有时它也有助于回到基础知识 实际上 我花了很长时间才真正掌握如何使用几个基本的mo
  • JUnit->Mockito->PowerMock->持续更新

    最近在公司做需求 要求开发需要有相应的单元测试代码 第一次做单测相关的知识 就在这做一篇总结 一 JUnit JUnit是Java最基础的测试框架 主要的作用就是断言 方法名 方法描述 assertEquals 断言传入的预期值与实际值是相
  • 求救,在频域分析语音信号谐波成分的方法有哪些

    求救 在频域分析语音信号谐波成分的方法有哪些 有一段语音信号 经过FFT之后变换到频域 目前想在频域分析其谐波成分 并找到谐波能量最大的K次谐波 matlab里可以用仿真powergui生成仿真的信号 然后FFT分析得到各谐波成分及能量 但
  • vi命令修改文件及保存的使用方法

    简单点 vi文件名 按 I 进入insert模式 可以正常文本编辑 编辑好之后按 esc 退出到 命令模式 再按 shift 进入 底行模式 按 wq 保存退出 还一种 把文件复制到本地修改好上传上去 vi编辑器是所有Unix及Linux系
  • 每日一练:用java打印水仙花数

    需求 在控制台输出所有的 水仙花数 解释 什么是水仙花数 水仙花数 指的是一个三位数 个位 十位 百位的数字立方和等于原数 例如153 3 3 3 5 5 5 1 1 1 153 思路 获取所有的三位数 准备进行筛选 最小的三位数为100
  • cp1.php969.net,eDrawings

    OzsgSFNGIFYxMy4wNSAKSQAAAABCAGDlUL0Spb29AAAAAGXlUD13vp89x0rNPVp42uy9B0AUSdMw3LMzsxHYJeec8 6SdoGVJagoiAFBMAOimNDDhBHMeqen
  • 怎么批量安装服务器的操作系统,批量安装服务器操作系统

    弹性云服务器 ECS 弹性云服务器 Elastic Cloud Server 是一种可随时自助获取 可弹性伸缩的云服务器 帮助用户打造可靠 安全 灵活 高效的应用环境 确保服务持久稳定运行 提升运维效率 三年低至5折 多种配置可选了解详情
  • 数组(持续更新后续)

    目录 数组定义 数组的组成部门 案例一 案例二 案例三 增强for循环 语法结构 执行规律 注意 案例 案例 案例 数组定义 变量 存储数据的空间 装数据的容器 变量中只能存储一个数据 数组 存储数据的空间 装数据的容器 数组中可以存储多个
  • sojson JS 逆向一 (简单版)

    背景 现在市面上很多web网页都是使用sojson加密的 所以 爬虫小伙伴对sojson的学习迫在眉睫 js 加密源码 var a b function w d w info 这是一个一系列js操作 d warning 如果您的JS里嵌套了
  • 202206-3 角色授权

    第三题 题干 角色授权 include
  • svn更新有问题svn: The working copy at' ' is too old

    SVN the working copy needs to be upgraded svn 低版本SVN检出代码 高版本SVN提交不了解决方法如下 项目右键 team Upgrade 即可 如下图 参考URL https blog csdn
  • Python:流动爱心图案

    from turtle import 导入了Python标准库中的turtle模块 并使用通配符 导入了该模块中的所有函数和变量 turtle模块提供了一个绘图窗口和一些绘图函数 可以用来绘制简单的图形 from math import s
  • python-爬虫初识-采集汽车资讯信息案例(一)

    目录 一 什么是爬虫 二 初识爬虫 采集汽车资讯信息 三 requests和BeautifulSoup模块基本使用 requests import requests BeautifulSoup from bs4 import Beautif