Cmder-Windows下终端模拟

Cmder是Windows下非常好用的终端模拟器, 常用于替换windows自带的终端。它可以在不同的标签页中同时连接不同的底层Shell,包括cmd、PowerShell、Bash和WSL,并提供相关增强功能和更加便捷的操作方式,这也正是它被大家称作为Windows下的神器的原因。

img

Cmder展示图片

正如Cmder官网所说,我们应该将Cmder看作一个软件包,而非单个软件,它包含了:

  • 控制台模拟器:Conemu (它是Cmder的基础)
  • Cmd.exe增强功能:clink (通过clink进一步增强cmd shell)
  • Unix tools on windows:git for windows

本文属于我的Cmder系列文章中的第一篇:《Cmder入门配置》

安装

安装方式一:在官网Cmder下载cmder压缩包,解压即可。这里注意解压路径不能位于需要管理员访问权限的地方,建议放在D盘并且确保路径中没有空格。

  • 将cmder添加到文件夹右键菜单(即添加Cmder here):

    以管理员权限打开 PowerShell;切换到 cmder 的解压路径;执行 .\cmder.exe /REGISTER ALL,即可添加,取消注册则执行 .\cmder.exe /UNREGISTER ALL

  • 为cmder创建桌面快捷方式。

如果你有自己的可执行程序,那么你可以考虑将他们放入 %cmder_root%\bin 目录,再将 %cmder_root%\bin 目录添加到 PATH 环境变量。

这里将上文的 %cmder_root% 修改为 cmder.exe所在路径,或者你可以考虑新建一个%cmder_root% 系统变量,或者将其也添加到PATH中(随意就好)。

安装方式二: 通过 scoop 安装(推荐)

1
2
3
4
# 安装完整版(自带git-for-windows)
scoop install cmder-full
# 安装mini版,不带git,安装后如果想使用bash则还需做一些配置,可见我的系列文章
scoop install cmder

scoop的安装和使用可参考我的相关文章:Scoop包管理工具 – 就是这个范儿

常用操作

中文配置

进入seting界面:点击Cmder窗口左上角的图标 或者 右下角的 图标,然后选择 setting

设置中文界面: 选择General->Interface language -> zh:简体中文

img

cmder01.png

粘贴复制

复制:只需选中一段文字那么该段文字就会被复制到剪贴板

粘贴:直接鼠标右键即可粘贴,或者使用 Ctrl + v 进行粘贴.

打开超链接

Ctrl + 鼠标点击 即可打开超超链接。

比如:

1
2
3
4
$ hugo server
...
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

只需要 Ctrl + 鼠标点击 上述命令输出中的 http://localhost:1313/ 即可在浏览器中打开该链接。

设置为默认终端

setting 👉 集成 👉 默认项目 👉 强制使用ConEmu作为控制台应用程序的默认终端`

如果允许某些程序出现错误,需要关闭此选项。

cmd模式和bash模式

新手可能会经常在cmd模式下输入bash相关的命令格式,导致相关错误;所以注意一下你当前在哪个模式。

比如在初次使用时,可能会出现切换不了路径的情况,这是因为你还没意识到自己在哪个模式下:

如果是用默认的bash, 可以直接 cd /d/myworkstation 这样跨盘切换。

如果用的是cmd模式, 需要先输入 d:来切换到d盘。

配置cmder以下拉方式划出

设置 👉 通用 👉 Quake 风格 👉

  • 勾选 Quake式向下滑动
  • 勾选 失去焦点时自动隐藏
  • 修改 动画时间 为 150

然后在 “通用” 设置处,设置 最小化和恢复 (Minimize/Restore hotkey )时所使用的快捷键,默认为 `Ctrl + ``

如果你同时使用VS Code会发现 Ctrl + ``快捷键在VS Code中是打开终端的默认快捷键;为避免冲突,我个人是选择将 cmder 的该快捷键修改为:Win + ``

alias别名机制

Cmder增加了alias功能: 它让你用短短的指令执行一些常见但指令超长又难以记忆的语法;

在控制台输入alias可以查看现有别名。

并且它有分别应用于 cmd,bash和PowerShell的 别名 。

1. cmd aliases:

%CMDER_ROOT%\config\user-aliases.cmd中添加 cmd aliases,它仅用于 cmd 命令

示例:

1
2
3
ls=ls --show-control-chars -F --color $*
pwd=cd
clear=cls

具体配置可参考:cmder/README.md

2. Bash/Mintty aliases:

对于bash,其配置文件的加载顺序是:

1
2
3
$CMDER_ROOT/config/profile.d/*.sh
$CMDER_ROOT/config/user-profile.sh
$HOME/.bashrc

所以我们可以在上面的文件中添加 alias 即可。

几个示例:

1
2
3
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'

由于 Git for Windows 会自动创建 ~/.bash_profile,而对此cmder会提示有冲突,此时可以创建一个~/.profile并在该文件中添加别名。(这里 ~表示$HOME

3.PowerShell aliases:

直接使用PowerShell 的 alias命令添加或在下面的文件中添加:

1
2
'$ENV:CMDER_ROOT\config\profile.d\*.ps1'
'$ENV:CMDER_ROOT\config\user-profile.ps1'

这里$ENV:CMDER_ROOT 指 cmder 的安装目录。

Cmder启动选项

img

cmder02.png

相关介绍

  • 在 启动(Startup)处设置 cmder 启动时需要执行的任务

    默认选择的启动项是 {cmd::Cmder} 这个命名任务,我们可以更改成其它的命令任务或者直接切换到其它的启动项。

    当选中某个命名任务时,下面的 “选中的任务内容” 下会显示该任务执行的具体内容

  • 我们也可以在 启动 -> 任务startup -> tasks)处更改和添加命名任务。

这里cmd::Cmder前面的cmd标明它是cmd模式,我们可以看到还有 bash 和 PowerShell等模式

自定义启动目录

下面就来克隆现有的{cmd::Cmder}添加一个设置自定义的启动目录的任务(Task):

img

cmder03.png

设置启动目录

img

cmder04.png

  • 任务参数:下面来看 “Task parameters”命令参数,阅读实例可知参数 /icon指定图标位置,/dir 指定启动目录,所以我们可以添加下面的参数:/icon "%CMDER_ROOT%\icons\cmder.ico" /dir "C:\Users\Fan"
  • 记得在 startup 的“ Specified named task” 处选择 cmd::diy1
  • 保存设置,退出,重新打开 cmder 查看效果

为任务添加快捷键

在上图中我们可以发现还可以为每个任务设置 热键 ,下面是我个人的热键设置:

  • 打开一个 cmd 任务标签页:Alt+c
  • 打开一个PowerShell 任务标签页:Alt+p
  • 打开一个 bash 任务标签页:Alt+b
  • 打开一个 WSL 任务标签页:Alt+l

Cmder连接Linux子系统(WSL)

Windows Subsystem for Linux(简称WSL)。

ConEmu(包括基于 ConEmu 修改的 cmder) 等终端模拟器也已经适配了 WSL 环境。

连接方式:

  • 添加一个标签页时(点击右下角的 ➕),选择 WSL --> bash
  • 或直接将启动任务指定为 {WSL::bash}

Windows系统的分区全部挂载于Linux子系统的 /mnt 目录

1
2
$ ls /mnt
c d e f g

这表示可用/mnt/c 来访问 C: 盘;这里还可以进行一些调整(例如创建从/c到的符号链接/mnt/c

也可以在Linux子系统中设置如下别名以便于切换:

1
2
3
4
# ~/.bashrc 
alias cdc='cd /mnt/c/'
alias cdd='cd /mnt/d/'
alias cde='cd /mnt/e/'

其它问题

中文乱码

Startup -> Environment 中添加下面的语句:

1
set LANG=zh_CN.UTF-8

如果没有出现乱码,则可以不添加。

如果打开的文本文件的编码方式不是 utf-8 那么在cmder中查看时会乱码,这种情况需要转换该文件的编码方式为 utf-8

img

cmder05.png

查看git log时乱码

这一般是git的配置问题,执行下面的命令,来配置git log的输出

1
git config --global i18n.logoutputencoding utf-8

或者在 .gitconfig 文件中配置

更多git乱码问题见: cmder中文乱码

ssh agent

每次想要向远程git仓库推送更新时,都需要先启动ssh代理,再加载(使用ssh-add)私钥,否则就报错而感到很烦。那么可以参考下面的解决方法:

cmd 模式中:

官方文档中有说在 cmd 模式中如何处理 ssh agent的相关问题:

To start the vendored SSH agent simply call start-ssh-agent, which is in the vendor/git-for-windows/cmd folder.

If you want to run SSH agent on startup, include the line @call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd" in %CMDER_ROOT%/config/user-profile.cmd (usually just uncomment it).

bash模式中:

官方文档中没有说如何在bash模式中处理ssh-agent的问题,但我们可以这样解决。

$HOME/.bashrc$HOME/.profilec文件中添加如下内容:

1
2
3
4
5
6
# 启动一个 ssh-agent 进程 
eval "$(ssh-agent -s)"
# 这里同时添加了两个私钥
ssh-add "C:/Users/Fan/.ssh/one_rsa" "C:/Users/Fan/.ssh/two_id_rsa"
# 清除上面命令的输出内容
clear

更多 ssh-agent 介绍可参考: SSH相关命令 中的ssh-agent部分

或者查看:Setting up git+ssh+gpg on Windows

补充

点击右下角的锁(🔒 :lock: )即可锁定视窗 ,可以让窗口无法再输入内容。

正确退出

我们一直是习惯于直接点击右上角的 × 来关闭程序,但是正确的退出方法应该是在cmder中输入 exit 来进行退出,只有这样退出历史记录才会保留,你在下次打开cmder时才可向上翻看上次历史。

Cmder系列

如果想要将Cmder对应的任务标签页配置为如下效果,则可参考该 系列文章

在Cmd下的效果:

img

cmder-cmd-20191215162952.png

PowerShell下不同主题的效果:

img

powershell-theme01.png

WSL bash下的效果:

img

Python-pymysql的使用

一、操作数据库模板

pymysql是Python中操作mysql的模块,(使用方法几乎和MySQLdb相同,但是在Python3中,mysqldb这个库已经不能继续使用了)

下载安装方法:

方法一、

在cmd中输入下面的命令即可下载:

1
pip3 install pymysql

方法二、

在pycharm集成开发环境中进行安装模块:

File–>Settings–>Project:xxx–>Project Interpreter–>右侧有个小 ‘+’ 号,点击—>在输入框里输入要安装的模块(pymysql)–>左下角Install Package

img

img

1 连接数据库—>创建游标—>执行SQL—>fetch获得数据,进行业务处理—>关闭游标—>commit—>关闭数据库连接

二、基本使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pymysql
user=input('用户名: ').strip()
pwd=input('密码: ').strip()

#链接
conn=pymysql.connect(host='localhost',user='root',password='',database='db2',charset='utf8') #与数据库的服务端建立连接,databases是我们要查询的表所在的数据库
#游标
cursor=conn.cursor() #执行完毕返回的结果集默认以元组显示
#配置结果集为字典形式
#cursor=conn.cursor(cursor=pymysql.cursors.DictCursor)

#执行sql语句
sql='select * from user where username="%s" and password="%s"' %(user,pwd) #注意%s需要加引号,就是一条基本的sql语句,事先要在user表中插入数据,这样查询才会有结果
print(sql)
res=cursor.execute(sql) #执行sql语句,返回sql查询成功的记录数目,我只在表中插入一条记录,查询成功最多所以也就一条记录数
print(res)

cursor.close()
conn.close()
if res:
print('登录成功')
else:
print('登录失败')

三、sql注入问题

首先明确一点:–是sql语句的注释,他会注释掉–sql后面的语句,语法为:–sql语句

根本原理:就根据程序的字符串的拼接,user=’%s’,我们输入一个xxx’ – haha,用我们输入的xxx加’在程序中拼接成一个判断条件name=’xxx’ – haha

1
2
3
4
5
#1、sql注入之:用户名存在,绕过密码
xingxing' -- 任意字符

#2、sql注入之:用户不存在,绕过用户名与密码
xxx' or 1=1 -- 任意字符

准备条件:

首先自己先创建一个库,在库下面创建一个表,在表中插入一些记录,准备好条件我们就可以来测试一下如何跳过用户名或密码直接登陆吧

img sql注入问题

那么我们如何避免用户通过输入特殊字符来跳过用户名或密码直接登陆呢

解决办法:

1
2
3
4
5
6
7
8
# 原来是我们对sql进行字符串拼接
# sql="select * from user where user='%s' and pwd='%s'" %(user,pwd)
# print(sql)
# res=cursor.execute(sql)

#改写为(execute帮我们做字符串拼接,我们无需且一定不能再为%s加引号了)
sql="select * from user where user=%s and pwd=%s" #!!!注意%s需要去掉引号,因为pymysql会自动为我们加上
res=cursor.execute(sql,[user,pwd]) #pymysql模块自动帮我们解决sql注入的问题,只要我们按照pymysql的规矩来。

代码实现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pymysql
user=input('用户名: ').strip()
pwd=input('密码: ').strip()

#链接
#localhost也可换成'127.0.0.1',port=3306
conn=pymysql.connect(host='127.0.0.1',port=3306,user='root',password='',database='db7',charset='utf8')
#游标
cursor=conn.cursor() #执行完毕返回的结果集默认以元组显示
#cursor=conn.cursor(cursor=pymysql.cursors.DictCursor) #返回的结果是列表内套着一个一个字典的形式


#执行sql语句
#改写为(execute帮我们做字符串拼接,我们无需且一定不能再为%s加引号了)
sql='select * from user where user=%s and pwd=%s' #!!!注意%s需要去掉引号,因为pymysql会自动为我们加上
print(sql)
res=cursor.execute(sql,[user,pwd]) #pymysql模块自动帮我们解决sql注入的问题,只要我们按照pymysql的规矩来。
print(res)

cursor.close()
conn.close()

if res:
print('登录成功')
else:
print('用户名或密码错误')

四、增、删、改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pymysql
'''链接(连接数据库并切换到指定的数据库下)'''
conn=pymysql.connect(host='localhost',user='root',password='',database='db2')
'''游标'''
cursor=conn.cursor()

'''
执行sql语句
part1
'''
sql='insert into user(username,password) values("liuqingzheng","123456");'
res=cursor.execute(sql) #执行sql语句,返回sql影响成功的行数
print(res)

'''part2'''
# sql='insert into user (username,oassword) values (%s,%s)'
# res=cursor.execute(sql,("xingxing","123")) #执行sql语句,返回sql成功插入的记录数
# print(res)

'''part3 插入'''
# sql='insert into user(username,password) values(%s,%s);'
# res=cursor.executemany(sql,[("xingxing","123"),("yueliang","123"),("taiyang","123")]) #可以同时插入多行记录,执行sql语句,返回sql影响成功的行数
# print(res)

'''part4 修改'''
# sql='update user set username=%s , password = %s where id=%s'
# res=cursor.execute(sql,['love','1314',5]) #执行sql语句,返回sql影响成功的行数,修改记录中id=5,将用户名该为love,密码改为1314
# print(res) #成功修改一条记录内容

'''part5 删除'''
# sql= 'delete from user where id = %s'
# res=cursor.execute(sql,2) #删除指定的某一条记录,删除第二掉记录
# print(res)
conn.commit() #提交后才发现表中插入记录成功,强调如果没有提交记录是不能插入成功的(增、删、改必须要commit)
cursor.close() #关闭游标
conn.close() #关闭连接(套接字)

五、查询之fetchone、fetchmany、fetchall

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pymysql
#建立与数据库的连接
conn=pymysql.connect(host='localhost',user='root',password='',database='db2')

#创建游标
cursor=conn.cursor()

#执行sql语句
sql='select * from user;'
rows=cursor.execute(sql) #返回的是表中所有记录的条数
cursor.scroll(3,mode='absolute') # 相对绝对位置移动,第一个参数是相对绝对位置移动的记录条个数
# cursor.scroll(1,mode='relative') # 相对当前位置移动,第一个参数是相对当前位置移动的记录条个数

#通过fetchone、fetchmany、fetchall拿到查询结果
res1=cursor.fetchone() #以元组的形式,返回查询记录的结果,默认是从第一条记录开始查询
# res2=cursor.fetchone() #会接着上一次的查询记录结果继续往下查询
# res3=cursor.fetchone()
# res4=cursor.fetchmany(2) #查询两条记录会以元组套小元组的形式进行展示
# res5=cursor.fetchall()

#打印查询的最终结果到终端
print(res1)
# print(res2)
# print(res3)
# print(res4)
# print(res5) #会元组套小元组的形式将表中的左右记录头查询出来展示在终端
print('%s行数据'%rows)

六、获取插入最新自增id

1
2
3
4
5
6
7
8
9
10
11
12
13
import pymysql
conn=pymysql.connect(host='localhost',user='root',password='',database='db2')
cursor=conn.cursor()

sql='insert into user(username,password) values(%s,%s);'
rows=cursor.execute(sql,['hxx','123']) #查看的就是当前插入这条记录的id,传入当前查询的sql语句和要插入的记录内容
# rows= cursor.executemany(sql,[('hxx','111'),('hxx1','222')]) #虽然插入2条记录,但是任然会以第一台哦记录的id为准
print(cursor.lastrowid) #在插入语句后查看,查看的id是当前插入的记录的第一条记录的id

conn.commit()
cursor.close()
conn.close()
print(cursor.lastrowid) #放在这也可以

七、注意事项

fetch获取的数据默认是元组,如果想要字典类型:

1
2
3
4
5
6
7
8
9
10
11
import pymysql
#链接
conn=pymysql.connect(host='localhost',user='root',password='',database='db2')
#游标
cursor=conn.cursor(cursor=pymysql.cursors.DictCursor)#在此处设置
#执行sql语句
sql='select * from user;'
rows=cursor.execute(sql)
res1=cursor.fetchone() #查询的结果就是一个字典的形式,字典的key就是对应的字段名,value就是字段名对应的记录内容
# res1=cursor.fetchall() #查询多条或所有结果是一个列表中套着一个一个字典
print(res1)

Xpath语法

模糊查询

XML 第一种存储方式,使用节点的InnerText 存储数据

user1.xml 片段如下:

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8" ?>
<users>
<user>
<username>huo</username>
<password>123</password>
<createtime>2008-06-17</createtime>
</user>
</users>

XPath 查询XML 代码如下:
//等值查询
string xpath = “users/user[username=’huo’ and password=’123’]”;
//模糊查询
string xpath = “users/user[contains(username,’huo’) and contains(password,’123’)]”;

XML 第二种存储方式,使用XMl 节点属性属性存储数据
user2.xml 片段如下:

1
2
3
<users>
<user username="huo" password="123" createtime="2008-06-17" />
</users>

XPath 查询XML 代码如下:
//xpath查询如:加”@” 用以查询属性值
//等值查询:
string xpath = “users/user[@username=’huo’ and @password=’123’]”;
//模糊查询:
string xpath = “users/user[contains(@username,’huo’) and contains(@password,’123’)]”;

兄弟节点

image-20201017174611337

Django笔记文档

pip3 install django
命令:
    # 创建Django程序
    django-admin startproject mysite
    # 进入程序目录
    cd mysite
    # 启动socket服务端,等待用户发送请求
    python manage.py runserver 127.0.0.1:8080

Django程序目录:
    mysite
        mysite
            - settings.py  # Django配置文件
            - url.py       # 路由系统:url->函数
            - wsgi.py      # 用于定义Django用socket, wsgiref,uwsgi

        # 对当前Django程序所有操作可以基于 python manage.py runserver
        manage.py 


1. 创建project
2. 配置:
- 模板路径
template目录

            TEMPLATES = [
                {
                    'BACKEND': 'django.template.backends.django.DjangoTemplates',
                    'DIRS': [os.path.join(BASE_DIR, 'template')],
                    'APP_DIRS': True,
                    'OPTIONS': {
                        'context_processors': [
                            'django.template.context_processors.debug',
                            'django.template.context_processors.request',
                            'django.contrib.auth.context_processors.auth',
                           'django.contrib.messages.context_processors.messages',
                        ],
                    },
                },
            ]


        - 静态文件路径
            static目录

            STATIC_URL = '/static/'
            STATICFILES_DIRS = (
                os.path.join(BASE_DIR,'static'),
            )

3. 额外配置
    MIDDLEWARE = [
        'django.middleware.security.SecurityMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        'django.middleware.common.CommonMiddleware',
        #'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.middleware.clickjacking.XFrameOptionsMiddleware',
    ]

母版

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
layout.html

{% block x1 %}{%endblock%}
<h1>ff</h1>
{% block x2 %}{%endblock%}
<h1>2</h1>...
{% block x3 %}{%endblock%}

index.html
{%extends 'layout'%}

{% block x1 %}dfssssssdfsd{%endblock%}

{% block x2 %}dfsdfsd{%endblock%}

{% block x3 %}fff{%endblock%}

Cookie

在浏览器上保存的键值对

1
2
3
4
5
6
7
8
def index(request):
request.COOKIES
request.get_signed_cookie('k1',salt='ff')
obj = HttpReponse(..)
obj = render(...)
obj = redirect(..)
obj.set_cookie(k1,v1,max_age)
obj.set_signed_cookie(k1,v1,max_age,salt='fff')

路由系统

1
2
3
4
url -> 函数
a. /login/ -> def login
b. /add-user/(\d+)/ -> def add_user(request,a1)
c. /add-user/(?P<a1>\d+)/ -> def add_user(request,a1)
PS:
    终止符:
        ^edit$
    伪静态
        url(r'^edit/(\w+).html$', views.edit),
d. 路由分发
    urls.py
        url(r'^app01/', include('app01.urls')),

    app01.urls.py
        url(r'^index.html$', views.index),
e. /add-user/(\d+)/  ->  def add_user(request,a1)  name=n1
    根据名称可以反向生成URL
    1. 在Python代码中
        from django.urls import reverse
        v = reverse('n1',kwargs={'a1':1111})
        print(v)

    2. url(r'^login/', views.login,name='m1')
    {% url "m1" %}

ORM操作

步骤:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1. 创建数据库
2. ORM利用pymysql第三方工具连接数据库
默认:
SQLlite
MySQL:
mysql -> MySQLDB(修改django默认连接mySQL方式

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME':'s4day70db',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': 3306,
}
}
3. 在init文件

import pymysql
pymysql.install_as_MySQLdb()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
MySQL -> settings.databases
- pymysql.install_as_mysqldb()

- 类
class Foo(models.Model):
# nid = models.AutoField(primary_key=True)
name = models.CharField(max_length=32)
class Bar(models.Model):
title = ...
f = FK...

Foo.objects.create(name='ff')
result = Foo.objects.all()
QuerySet[Foo(),Foo()Foo()Foo()]
result = Foo.objects.filter(id=1).first()
result = Foo.objects.filter(name="alex").first()
QuerySet[obj,]
QuerySet[obj,obj,obj]
obj

Foo.objects.filter(id=1).delete()
Foo.objects.filter(id=1).update()

ORM操作表:
创建表
修改表
删除表
操作数据行:
增删改查

python manage.py makemigrations

  1. 视图函数 CBV,FBV

mysql安装详细步骤

一、MySQL 下载

直奔主题,首先进入https://www.mysql.com/downloads/,界面如下:

image-20201009105537632

然后,将该页面划到最后,看到如下界面:

image-20201009105549327

进去后看到:

image-20201009105603824

点击上图中的第二步后,出现下图:

image-20201009105624541

先选择版本,然后根据电脑是32位|64位来下载相应的版本。点击download后,出现下图:

image-20201009105636457

直接下载会很慢,复制链接到迅雷中会快很多,下载完成。

二、MySQL 安装

安装后解压,将该目录添加至环境变量(可以网上搜索解决方案)中,并检查根目录中有没有my_default.ini文件,没有的话,需要自己创建一个,文件名字为my.ini;首先创建一个txt文件,其中内容为:

1
2
3
4
5
6
7
8
9
10
11
12
[mysqld]

port = 3306
basedir=D:/mysql5711 #修改为你的路径
datadir=D:/mysql5711/data
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysql]
default-character-set=utf8

修改文件名为my.ini;

将该文件放置解压文件的根目录中

image-20201009105646472

然后以管理员身份运行cmd.exe;

1
2
3
4
mysqld -install
mysqld --initialize-insecure --user=mysql -- 初始化
net start mysql
mysqladmin -u root -p password 你的密码

image-20201009105656811

安装完成!

继续输入mysql –version,查看是否安装成功

image-20201009105706600

安装成功!

三、登陆

cmd进入后,输入mysql -u root -p ,然后输入你刚才设置的密码;quit 退出。

image-20201009105715618

Docker 安装

1
2
3
4
5
6
7
8
9
10
11
12
docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=1 \
-d mysql:5.7
参数说明
-p 3306:3306:将容器的 3306 端口映射到主机的 3306 端口
-v /mydata/mysql/conf:/etc/mysql:将配置文件夹挂载到主机
-v /mydata/mysql/log:/var/log/mysql:将日志文件夹挂载到主机
-v /mydata/mysql/data:/var/lib/mysql/:将配置文件夹挂载到主机
-e MYSQL_ROOT_PASSWORD=root:初始化 root

英语大佬的诞生的学习笔记QAQ

image-20220312144055304

image-20220312144204445

image-20220312144313840

image-20220312144258560

1、名词(n.),Nouns 表示人或事物的名称 box, pen,tree,apple
2、代词(pron.),Pronouns 代替名词、数词、形容词We, this, them,myself
3、形容词(adj.), Adjectives 用来修饰名词,表示人或事物的特征 good, sad, high, short
4、数词(num.),Numerals表示数目或顺序 one,two, first
5、动词(v.),Verb 表示动作或状态 Jump,sing,visit
6、副词(adv.),Adverbs 修饰动、形、副等词,表示动作特征 there,widely,suddenly
7、冠词(art.),Articles 用在名词前,帮助说明名词所指的范围 a, an, the
8、介词(prep.),Prepositions 用在名词或代词前,说明它与别的词的关系 in,on,down,up
9、连词(conj.),Conjunctions 表示人或事物的名称if,because,but
10、感叹词(int.), Interjections 代替名词、数词、形容词等 oh,hello,hi,yeah

专升本英语考点精讲

image-20220417200229054

image-20220417200711547

英语动词时态

image-20220221161408846

image-20220303112951693

image-20220304112817856

英语“不规则”动词“规律”

过去式 = 过去分词 = 原形

原形 过去式 过去分词 汉语意思
bet bet bet 打赌
cost cost cost 耗费()
cut cut cut 切,割
hit hit hit 撞,击打
hurt hurt hurt 使…伤痛
let let let
put put put
read read read
set set set 安排,安置

过去式改字母, 过去分词 = 原形

原形 过去式 过去分词 汉语意思
become became become 成为
come came come
run ran run

过去式改字母, 过去分词 = 原形**+en**

原形 过去式 过去分词 汉语意思
eat ate eaten
fall fell fallen 落下
forbid forbade forbidden 禁止
forgive forgave forgiven 原谅,宽恕
give gave given
ride rode ridden
see saw seen 看见
write wrote written

过去式改字母, 过去分词 = 过去式 + en

原形 过去式 过去分词 汉语意思
break broke broken 打破,折断
choose chose chosen 选择
forget forgot forgotten 忘记
freeze froze frozen
speak spoke spoken
wear wore worn 穿

原形ow, 过去式ew, 过去分词n

原形 过去式 过去分词 汉语意思
blow blew blown
draw drew drawn
fly flew flown
grow grew grown 生长
know knew known 知道

原形i, 过去式a, 过去分词u

原形 过去式 过去分词 汉语意思
begin began begun 开始
drink drank drunk
ring rang rung 门铃响,电话铃响
sing sang sung
swim swam swum 游泳

原形, 过去式ought, 过去分词ought

原形 过去式 过去分词 汉语意思
bring brought brought 带来
buy bought bought
fight fought fought 打架
seek sought sought 寻求
think thought thought 思考

原形, 过去式aught, 过去分词aught

原形 过去式 过去分词 汉语意思
catch caught caught 捉,抓
teach taught taught

过去式改元音字母, 过去分词 =过去式

原形 过去式 过去分词 汉语意思
dig dug dug
feed fed fed
find found found 发现
get got got 得到
hold held held 拥有
lead led led 引导
meet met met 遇见
sit sat sat
babysit babysat babysat 临时照看
win won won

过去式改**辅音**字母, 过去分词 =过去式

原形 过去式 过去分词 汉语意思
build built built 建造
rebuild rebuilt rebuilt 重建
deal dealt dealt 处理
hear heard heard 听见
lend lent lent 借贷
make made made 制造
mean meant meant 意思
send sent sent 寄,送
spend spent spent 花费
bend bent bent 使弯曲

过去式改字母 + t, 过去分词 =过去式

原形 过去式 过去分词 汉语意思
feel felt felt 感到
keep kept kept 保持
leave left left 离开
sleep slept slept
smell smelt smelt
sweep swept swept

虚拟语气

image-20220408151732346

非谓语动词

介词

一、空间介词

一、易混淆的空间介词

  1. on/in the tree
    on the tree 长在树上的
    如:There are some apples on the tree
    in the tree (外部事物)在树里
    如:There are some birds in the tree
  2. on,over,above
    on:表示物体与物体接触
    over:在…正上方(与under相对);越过上空
    above:在…上方(与below相对)
  3. across,through
    across 从表面横过
    through 从内部穿过
  4. between,among
    between 既可以表示两者之间的比较,也可以是多者的两两之间(如You shouldn’t eat between meals)
    among 表示三者及以上(口语中可被between替换)

二、其他常用空间介词
past 路过;经过
near 在…附近
by/beside/next to 在…旁边,比near距离更近
round/around 环绕
along/up/down/沿着(向上/下)
toward/towards 朝着…的方向,与to相近
onto/into 到…上面/内部
out of 从…出来
opposite 在…对面
against 与…相反;倚,靠
off 离…有些距离

二、时间介词

按提问方式分了下类

  1. 划线提问用when
    in/on/at 范围从大到小
    during 在……期间
    before/after 在…之前/之后
    from…to… 从…到…
  2. 划线提问用how long
    for 持续
    since 自从
  3. 划线提问用how soon
    in (从此刻起的)某段时间内
  4. by 不迟于…之前

三、方式介词

  1. in/through/by 通过…方式(三者用法上有细微区别)
  2. with 用…(工具)
  3. on 在…(电子设备)上面

四、原因介词

  1. with …是和…分不开的原因
    例:The rabbit is shaking with cold.
  2. for/because of/due to/owing to/on account of 由于…

五、关于介词

  1. about/on 关于
  2. of 此外的;附加的
    例:think of 想起

六、数值介词

  1. at 在…数值点
    例:at a high price
  2. by 按…度量标准
    例:They get paid by the hour.
  3. for 以…的价钱
    例:I bought these books for 100 Yuan.

七、状态介词

  1. in 在…状态中
    例:in progress 在进行(状态)中
  2. on 受到…的支持
    例:on drugs
  3. at 在…状态点
    例:at work
  4. under 在(框架、前提)下
    例:under construction

八、排除介词

  1. besides 除了……还有(包含在内)
  2. except/except for 除了…外 (不包含在内)
  3. 辨析except,except for
    (1)except 表示从整体中剔除出去
    例:Everybody went to the party except the rabbit.
    (2)except for 往往用来对之前的内容进行反驳
    例:The party is great except for the loud music

英语中助动词有哪些

(1) am,is,are ,was ,were,(帮助变进行时态,帮助变被动语态

(2) do ,does,did (帮助句子变疑问句,否定句,强调谓语动词作用

(3)has ,have (帮助句子变现在完成时态作用)

(4) had ,(帮助句子变过去完成时态,以及虚拟语气倒装

(5) will ,shall (帮助句子变一般将来时态

(6) would ,should (帮助句子变过去将来时态

(7) be going to(帮助句子变一般将来时态

第一讲 语序和五种基本句式

image-20210427214046070

系动词:起连接作用的动词

表语:描述主语

物直人间 例如 我喜欢他送我的一朵花

第二讲 be动词的形式和用法

image-20210427214136743

is am are 一般现在时

was 单数 were 复 数 主语后 过去式

1、is的过去式是was。

2、am就是原型。

3、are的过去式是was。

1、am的用法

第一人称I+am。I am 还可缩写成I’m。但是am与not不能缩写。

2、are的用法

复数名词+are 如第二人称you+are; 一人称复数we+are; 三人称复数they+are。

3、is的用法

第三人称单数+is,如he(男) +is ; she(女)+is; it(不是人)+is。、

过去式was

being 现在分词

been 过去分词

用法: 后面接名词形容词,地点副词,或短语做补充语

过去式—-就是我们所熟知的动词过去式 如do–did

过去分词—一般用于被动语态表被动 如do–done

现在分词—-相当于动词ing形式 用于进行时

第三讲 Be动词的否定提问和回答

image-20210427215241323

提问be动词提前

第四讲 代词的主格和宾格

做主语的代词叫主格形式 主格代词:I,he,she,it,you,we,they
宾格代词在宾语位置 宾格形式:me,him,her,it,you,us,them

第五讲 名词性/形容成型物主代词

总结

image-20210420181304401

第六讲 反身代词

反身代词:

image-20210420181702072

第七讲 实意动词的特征

image-20210420182905335

词后加S,es,…. 动词单三时态上的变化

有时态和数量上的变化

第八讲 实意动词的否定/疑问/回答

使用助动词否定

在助动词

do does 一般现在时

did 一般过去时

+not+实意动词 构成否定

does用于第三人称单数did用于过去式

image-20210426174836830

三单 she、he 、it

现在时 非三

现在时 三单

过去时

例子:

image-20210426180143439

使用助动词提问

提问时助动词句首,如果原句中的实意动词发生了时态上的变化则要变成原形

通常三单动词会发生一些数量上的变化

image-20210426181245885

image-20210426181611362

第九讲 使用疑问词进行提问和回答

谁 什么 那 怎么样 缺失这些 进行具体的提问 使用疑问词 例:谁买了那本书

使用疑问词进行提问:

image-20210426181832826

什么时候,哪,谁,什么,怎么

提问的不是主语时 例如 对原句中的宾语提问时,加助动词在疑问词后面,如果原句中有助动词则把它移到疑问词后面

image-20210426182844061

语序:疑问词 助动词 主语 句子的其他成分

第十讲 使用疑问词进行提问和回答(2)

image-20210426183456351

多长时间,多远,多长时间一次,为什么

对句子中不是主语的成分进行提问时,使用助动词若原句有助动词或者系动词就提到疑问词后后

然后新句后面的动词保持原型

第十一讲 名词

名词分两类:

可数名词 不可数名词

可数大于等于二变化: 一般 加s

元音字母:a e i o u

image-20210427174356141

元音开头 a 辅音 an

image-20210427175432345

第十二讲 指示代词和不定代词

指示代词:表示人或事物的代词,通常代替前面已经提到的名词 this(these) that(those)

image-20210427175959358

oen一个,the other另外一个,some一些,any任何,something某物,nothing什么都没有

常用不定代词有:

some(something,somebody,someone),any(anything,anybody,anyone), no(nothing,nobody,no one),all,each,both,much,many,(a)little,(a)few,other(s),another,none,one,either, neither等。 一般来讲,修饰不定代词的词要置于其后。

由body,one,thing构成的合成代词:

somebody,anybody,everybody,nobody

someone, anyone,everyone,no one

something,anything,everything,nothing

作代词的限定词:

all,another,any,both,each,either

few,little,many,much,neither,none

other,some

还有不能兼作代词的限定词(形容词)(主要是every,no)。

第十三讲 形容词

形容和修饰名词

image-20210427180428605

The +形容词=复数,表示抽象意义的事物,表一类后面的动词用复数——后接单数动词,如The new takes…

the +形容词,表示一国的全体国民——后接复数动词,如The French speak…。

the+形容词的用法有很多,老师这里只讲了一种。具体自己百度

第十四讲 副词

副词可以修饰动词,形容词,其他副词以及其他结构

副词(Adverb 简称adv.)是指在句子中表示行为或状态特征的词,用以修饰动词形容词、其他副词或全句,表示时间、地点、程度、方式等概念。副词可分为:时间副词、频率副词地点副词、方式副词、程度副词疑问副词连接副词关系副词、表顺序的副词以及表完成的副词。

image-20210427181438214

image-20210511172625744

image-20210511173546389

always一直, usually通常, often经常, sometime有时, never从来不

第十五讲 不定量表达法 (1)some、any、most

image-20210513165930630

some一些, any一些, most最多, every每个, all所有

image-20210513165847140

I’d的全写是I would/could/should/had。 这是过去完成时时态,had been

image-20210513170225636

image-20210513170239560

image-20210513170339042

第十六讲 不定量表达法 (2)both,either,neither,many,much

image-20210513170709518

image-20210513170814711

第十七讲 不定量表达法 (3)

image-20210513171131468

image-20210513171238679

image-20210513171422746

第十八讲 There/Here be 句型

image-20210513172019549

image-20210513172028333

第十九讲 一般现在时和现在进行时

一般现在时

现在分词,单三,原形

image-20210513172320682

一般现在时否定和疑问

image-20210513173147646

非三单用 do don’t

does 动词边原形

一般现在时动词单三变化

image-20210513172616875

现在进行时

image-20210513173513961

be + doing

过去进行时*

在现在进行的基础上奖be改为过去式

be + doing

The rabbit is eating a carrot => The rabbit are eating a carrot

You are watching my video. => You were watching my video.

将来进行时*

will + be +动词的现在分词

l will be eating a carrot for lunch tomorrow from lPM to 3PM.(我明天午饭会在吃萝卜这个动作过程中.)

动词现在分词变化规律

现在进行时否定和疑问

image-20210513173901203

be 动词否定/提前

第二十讲 一般过去和过去将来时

一般过去时

image-20210513175325456

主语+动词ed (过去式) + 其他

动词一般过去式变化

image-20210513175549255

结构和一般现在时差不多

image-20210514142855569

过去进行时

image-20210514142918343

was/were + doing

第二十一讲 将来时

一般将来时

image-20210514143251965

image-20210514143347156

帮助构成将来时

主语时第一人称 I,We 通常使用 shall

will 或shall + 动词原形

be going to

image-20210514143616251

image-20210514143737159

过去将来时*

将一般将来时will 改为 would : would + 动词原形

第二十二讲 完成时

现在完成时

image-20210514144114440

hava + p.p (过去分词)

过去完成进行时*

hava + been + ing

现在完成进行时*

had + been + ing

过去完成时

image-20210514145126602

had + p.p

还有过去/现在/将来完成进行时。

将来完成进行时态

will + hava + been + 动词的现在分词

将来完成时*

will + hava +动词的过去分词

第二十三讲 动词的用法

image-20210514145938717

image-20210514150204747

image-20210514150454144

第二十四讲 情态动词(1)can/colud/may/might

image-20210429164257982 image-20210429164540608

第二十五讲 情态动词(2)should/ougth to/must(have to)

必须 必要

image-20210429170543667 image-20210429170739644

第二十六讲 情态动词(3)need/don’t have to

image-20210429171315594

动词不定式是一种非限定性动词,由to+动词原形构成,但在有些情况下to可以省略。它还是属于动词,本身可以带宾语和状语。动词不定式在句中可以作主语、宾语、表语、定语和状语,还可用在复合结构中,而且有完成式、进行式、完成进行式和否定形式。动词不定式的被动形式除了一般形式外还有其完成式和进行式。

image-20210429171443701

image-20210429171454375

image-20210429171818807

第二七讲 情态动词(4) had better/would rather

image-20210429172936462

image-20210429173039249

image-20210429173140782

第二十八讲 情态动词(5)used to/wolud+v

image-20210429173716915

image-20210429173904945

image-20210429174514935

第二十九讲 情态动词否定和疑问

image-20210429175049290

image-20210429175655349

第三十讲 情态动词+have+p.p 推测

情态动词加 过去完成时的形式

image-20210429180156802

image-20210429180432168

image-20210429180623588

第三十一讲 被动语态(1)被动语态构成和含义

image-20210430163900882

image-20210430165735479

一般现在时:be+done (be随人称变化);现在进行时:be+being+done

现在完成时:have/has+been+done;过去完成时:had+been+done

一般过去时:was/were ;过去进行时:was/were+being+done;

一般将来时:will be done;过去将来时:would be done

将来完成时:will have been done;将来进行时:will be being done

现在完成时的被动语态结构为:have/has+been+及物动词的过去分词

过去将来时的被动语态结构为:would/be going to+be动词原形+及物动词的过去分词

一般将来时的被动语态结构为:shall/will/be going to+be动词原型+及物动词的过去分词

过去进行时的被动语态结构为:was/were+being+及物动词的过去分词

现在进行时的被动语态结构为:am/is/are+being+及物动词的过去分词

一般现在时的被动语态结构为:am/is/are+及物动词的过去分词

一般过去时的被动语态结构为:was/were+及物动词的过去分词

第三十二讲 被动语态(2)被动语态和情态动词

image-20210507165444605

image-20210507165832700

第三十三讲 被动语态(3)(by+行为者)可省略

image-20210507170229659

image-20210515143615840

下节课是什么? 英语 下下节课呢? 还是英语!

第三十四讲 被动语态(4)被动语态疑问句形式

image-20210507170800031

image-20210507171120863

image-20210515144943484

第十三五将 [非谓语动词1]to+动词原形VS.动词原形+img

image-20210507171823948

image-20210507171935224

image-20210507172015587

image-20210507172102211

image-20210507172220348

image-20210507172819378

第三十六将 非谓语动词(2)假主语/真主语不定式/动名词的否定形式

image-20210507174019342

image-20210507174253216

image-20210507174337253

第三十七将 非谓语动词(3) to不定式表示目的

image-20210507174815692

image-20210507175005709

so as to 不能让放句首

image-20210515152327855

第三十八将 非谓语动词(4) 常见的不定式和动名词句型

image-20210507175202020

image-20210507175353133

image-20210515152928904

第三十九将 非谓语动词(4) 现在分词/过去分词/分词句

image-20210507175651450

image-20210507175841854

动词的过去分词,可以用在完成时,和被动语态

现在分词,可以做动名词,和现在分词

image-20210507175940741

# 第四十讲 原形不定式(1)使役动词

原形不定词是无to的不定词,即原形动词。

image-20210509141541162

image-20210509141737642

get翻译使

help 帮助

image-20210509142116033

# 第四十一讲 原形不定式(2)感官动词

image-20210509143010427

感知到什么东西怎么样了

image-20210509143115770

宾语被怎么样了

第四十二讲 假设(1) 只单纯表示条件

通常有一个主句和一个从句

image-20210509143650502

if从句使用一般现在时

image-20210509144015187

第四十二讲老师的错误纠正啦,The cat______(scratch) you if you pull her tail。空格里应该填写will scratch.表示将会发生,具体见崔荣容老师16年

第四十三讲 假设(2) 与现在事实相反的虚拟语气

image-20210509144649362

# 第四十四讲 [假设(3)]与过去事实相反的虚拟语气

image-20210509145248109

# 45 第四十五讲 [假设(4)]wish . as if+过去 过去完成时

image-20210509150255877

as…as…像什么一样

虚拟语态中 be的过去式一般用were 而不用was 不论单复数

image-20210509150930509

46 第四十六讲 定语从句[关系代词]that who which whom

image-20210509151212779

image-20210509151255536

image-20210509151738103

image-20210509151813514

image-20210516162328773

# 47 第四十七讲 定语从句[关系副词]when where why

分别表示时间地点和原因

image-20210516163244132

image-20210516163334984

image-20210516163431341

48 第四十八讲 宾语从句 连词

image-20210509152511920

image-20210509152722488

if whether 翻译为是否

image-20210509152816892

在宾语从句中翻译 谁 谁 谁的 什么

image-20210509153135672

49 第四十九讲 比较级&最高级(1)

image-20210509153254387

image-20210509153534449

50 第五十讲 比较级&最高级(2)

image-20210509153815694

image-20210509154031263

动词

image-20210511143106734

image-20210511143413877

image-20210511143725234

助动词 实意动词,系动词

动词分类问题

image-20210511144244401

image-20210511144616827

谓语的构成

image-20210511141933522

image-20210511142035256

image-20210511142207757

image-20210511142456987

助动词的作用

image-20210511145435685

image-20210511145621809

image-20210511151127759

虚拟语气基础

倒装基础

image-20210511151503916

image-20210511152336361

非谓语动词

翻译

image-20210514165954002

for since ago

for + 一段时间
since + 时间点 自从什么开始
一段时间 + ago 与一般过去时连用

表示过去已经开始持续到现在的动作或状态常用的时间状语有:for,since,how long,so far,these days等.
Since+过去点的时间,for+一段时间(数词+量词),而ago是表示以前!

wolud you like to…?

1、Would you like后面接名词 :

(1)Would you like a glass of water?你想喝杯水吗?

(2)Would you like some apples?你想要(吃)苹果吗?

2、Would you like后面接动词不定式 :

(1)Would you like to play with me?你愿意和我一起玩吗?

(2)Would you like to have a rest?你要休息一下吗?

3、Would you like后接名词或代词+动词不定式

(1)Would you like me to call a taxi 我去叫一部出租车来怎么样?

(2)Would you like my father to teach you english?你想叫我爸爸教你英语吗?

Would you like…是一个语气婉转的习惯用语,常常用来询问某人现在的意志和愿望,意为“愿意”、“想要”和Do you want…用法相同,但较之委婉、礼貌。在说英语的国家里,Would you like…更常用,其肯定回答是:“Yes,please.”若是否定回答,可说 ::“No,thanks.”

祈使句

强调句

I used to do…

表曾经

There be

there be表示的是“某处有(存在)某人或某物”

there will be是there be的一般将来时态,表示“某处将会有(存在)某人或某物”

as…as的用法

as…as意为”和……一样”,表示同级的比较.使用时要注意第一个as为副词,第二个as为连词.其基本结构为:as+ adj./ adv.+as.例如:
(1)This film is as interesting as that one.这部电影和那部电影一样有趣.
(2)Your pen writes as smoothly as mine.你的钢笔书写起来和我的一样流畅.
其否定式为not as/so +adj./ adv.+as.例如:
This dictionary is not as/so useful as you think.这本字典不如你想象的那样有用.
若有修饰成分,如twice,three times,half,a quarter等,则须置于第一个as之前.例如:
Your bag is twice as expensive as mine.你的袋子比我的贵一倍.
几个关于as…as的常见句型:
(1)as…as possible
Please answer my question as soon as possible.请尽快回答我的问题.
(2)as…as usual/before
She looks as pretty as before.她看起来和以前一样漂亮.
(3)as long as…(引导条件状语从句)
It took us as long as three years to carry out the plan.我们花了长达三年的时间才完成这项计划.
(4)as far as
He walked as far as the railway station yesterday evening.昨天傍晚,他一直散步到火车站.
(5)as well as
She cooks as well as her mother does.她烧菜烧得跟她母亲一样好.
一些带有as…as结构的常见短语归纳:
as busy as a bee像蜜蜂一样忙碌
as easy as ABC像ABC一样容易
as deep as a well像井一样深
as light as a feather像羽毛一样轻
as soft as butter像黄油一样软
as rich as a Jew像犹太人一样富裕

have been和have gone的区别

have been to 表示曾经去过,暗示已经返回
have gone to 表示已经去了,还没返回

I have been to Paris. ( 我曾经去过巴黎<现在不在巴黎>)
He has gone to Shanghai. ( 他已经去上海了<现在在上海>)

另外,在句子当中有延续性时间状语的时候(since…ago, for…等),have been in/at 可以代替have gone to, 表示某人已经去了某地多长时间了。

He has gone to Shanghai and has been there(in Shanghai ) for 2 weeks. ( 他已经去上海了,并在那里呆了两周)

试卷单词

阅读理解的题目中常出现的词

一、主旨题:
show说明,展示
mean意思是
purpose目的
view看法
example例子
experment实验
conducte行为
researcher研究者
meant目的
conclusion结论
discuss讨论
idea设想
main主要的
mainly主要地
primarily主要地
topic话题
concemed讨论
title标题
replaced取代
article文章,项目
argues表明,认为,坚持,争论
indicates表明
summary总结
leare from结论
attitude态度
toward对于
described描述
carry 表达,携带
message主旨,信息
lead to导致
cause原因
reason for原因
implied暗示,意味
infer推测
concluded推断
suggest建议
advice劝告

二、词义题:
refers提到,引用,参考
stands for代表,象征
probably可能,大概
replaced取代
close接近的

三、是非题:
The least possible choice最不可能的选择
true真空的
correct正确的
false不真实的
mentioned提到的
except除了
opposite对立
statement陈述
describes描述

四、因果题:
in that
as
due to
consequently因此
as a resulf
depehd on
because of
why
basis
reason理由
result结果
because
for
since
therefore
lead to导致
result in导致
result from起因于
all this
that is why
for these reasons
as reasons作为原因

五、比较题:
first
major主要的,重要的,较多的
none一点也不,没有一个
only

aware of the risks了解到这些风险
according根据,按照,相应的,相符的
centers on集中在。。。上
envisions future展望将来
deals with与。。。交易
expression表达
however不管怎样,然而,可是
illustrates with阐明,举例,说明
is aimede at其目的在于
problem问题
whether…or…是。。。还是。。。
whether or no不管怎样
lies in在于
focus on针对,聚焦于,集中于
it comes to涉及到
it is essenhal to 最重要的是
appears出现
likely可能
probably可能
possible可能的

六、主旨题:
By “…challenges explanation”(Line 2.pare.1)the author means that________
goal
The author’s purpose in writing the second paragraph is to show that children_________
view
The author gives an example in Paragraph * mainly to show that_______
The experment conducted by the researcher was meant to____________
The findings of the experiment show that__________
What is the one of the possible conclusions of the experiment_________
The passage mainly discusses______
about
The idea_________
the idea of________
The main idea of this passage is _
What is the main topic of this passage?
What is the passage primarily concerned about?
Which of the following would be the best title for the passage?
best replace the title
The best title for this passage might be____

Which is the best summary of ____
…..can we leare from this passage
The author’s attitude towards…..is______
writer’s to
The tone of this passage can be described as____________
describes 描述
Which of the following may lead to (caust) ___
The main reason for…is _____
….mastly for________
It is implied in the passage that________
The passage implies(suggests)that________
as________suggest
It can be inferred from the passage that______
It can be concluded from the passage that_______
From the passage we can infer (draw the conclusion)that________
The passag
The passage appears to be (is most likely) a part of_________.
Where would this passage most probably be found?

杂记

image-20210529110228349

同位语:和前面名词有“相同地位”,可以互相替代 。

宾补:补充说明,使句子更加完整,不能去掉 。

定语:修饰限定名词,让句子更加饱满,是附加成分

从句

判断从句

image-20210530110855408

题目总结

2014

语法

image-20210605105443003

image-20210605105526837

image-20210605105539932

image-20210605105606855

image-20210605105621290

image-20210605105721627

as…as

keep doing sth.坚持做某事 强调状语的继续,常与表示延续动作的动词与静止状态的动词连用

介词of 后面用which非限制性定语从句

非谓语动词的用法 by 用被动

考查的是It is +名词+todo sth的句型 不定式作主语

2015

语法

2013

语法

虚拟语气的用法

时态

非限制性定语从句 的关系词

动名词在句中起名词作用

Python爬虫笔记

# requests模块

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#requests.session():维持会话,可以让我们在跨请求时保存某些参数


import requests

#实例化session
session = requests.session()

#目标url
url = 'https://www.douban.com/accounts/login'

form_data = {
'source': 'index_nav',
'form_email': 'xxx',
'form_password': 'xxx',
'captcha-solution': 'stamp',
'captcha-id': 'b3dssX515MsmNaklBX8uh5Ab:en'
}

#设置请求头
req_header = {
'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36',
}

#使用session发起请求
response = session.post(url,headers=req_header,data=form_data)

if response.status_code == 200:

#访问个人主页:
url = 'https://www.douban.com/people/175417123/'

response = session.get(url,headers = req_header)

if response.status_code == 200:

with open('douban3.html','w') as file:

file.write(response.text)
1
2
3
4
5
6
7
8
9
10
import requests
import time
mycookie = { "PHPSESSID":"56v9clgo1kdfo3q5q8ck0aaaaa" }
x = requests.session()
requests.utils.add_dict_to_cookiejar(x.cookies,{"PHPSESSID":"07et4ol1g7ttb0bnjmbiqjhp43"})
x.get("http://127.0.0.1:80",cookies = mycookie)
time.sleep(5)
#请求以后抓包可以检验一下是不是添加成功
x.get("http://127.0.0.1:80")

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#HTTP请求类型
#get类型
r = requests.get('https://github.com/timeline.json')
#post类型
r = requests.post("http://m.ctrip.com/post")
#put类型
r = requests.put("http://m.ctrip.com/put")
#delete类型
r = requests.delete("http://m.ctrip.com/delete")
#head类型
r = requests.head("http://m.ctrip.com/head")
#options类型
r = requests.options("http://m.ctrip.com/get")

#获取响应内容
print r.content #以字节的方式去显示,中文显示为字符
print r.text #以文本的方式去显示

#URL传递参数
payload = {'keyword': '日本', 'salecityid': '2'}
r = requests.get("http://m.ctrip.com/webapp/tourvisa/visa_list", params=payload)
print r.url #示例为http://m.ctrip.com/webapp/tourvisa/visa_list?salecityid=2&keyword=日本

#获取/修改网页编码
r = requests.get('https://github.com/timeline.json')
print r.encoding
r.encoding = 'utf-8'

#json处理
r = requests.get('https://github.com/timeline.json')
print r.json() #需要先import json

#定制请求头
url = 'http://m.ctrip.com'
headers = {'User-Agent' : 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19'}
r = requests.post(url, headers=headers)
print r.request.headers

#复杂post请求
url = 'http://m.ctrip.com'
payload = {'some': 'data'}
r = requests.post(url, data=json.dumps(payload)) #如果传递的payload是string而不是dict,需要先调用dumps方法格式化一下

#post多部分编码文件
url = 'http://m.ctrip.com'
files = {'file': open('report.xls', 'rb')}
r = requests.post(url, files=files)

#响应状态码
r = requests.get('http://m.ctrip.com')
print r.status_code

#响应头
r = requests.get('http://m.ctrip.com')
print r.headers
print r.headers['Content-Type']
print r.headers.get('content-type') #访问响应头部分内容的两种方式

#Cookies
url = 'http://example.com/some/cookie/setting/url'
r = requests.get(url)
r.cookies['example_cookie_name'] #读取cookies

url = 'http://m.ctrip.com/cookies'
cookies = dict(cookies_are='working')
r = requests.get(url, cookies=cookies) #发送cookies

#设置超时时间
r = requests.get('http://m.ctrip.com', timeout=0.001)

#设置访问代理
proxies = {
"http": "http://10.10.10.10:8888",
"https": "http://10.10.10.100:4444",
}
r = requests.get('http://m.ctrip.com', proxies=proxies)

数据解析

正则

xpath

bs4

动态加载数据的爬取

selenium

环境搭建错误

移动端数据的爬取

-异步的爬虫
-10种反爬机制
-scrapy框架
-异步的爬虫框架

异步爬虫

1
2
3
4
#线程池
from multiprocessing.dummy import Pool
map( callback,alist)
#可以使用callback对alist中的每一 个元素进行指定形式的异步操作

Scrapy

1
2
3
4
5
6
7
创建项目:scrapy startproject xxx
进入项目:cd xxx #进入某个文件夹下
创建爬虫:scrapy genspider xxx(爬虫名) xxx.com (爬取域) #爬虫名字不能和项目名一样
生成文件:scrapy crawl xxx -o xxx.json (生成某种类型的文件)
运行爬虫:scrapy crawl XXX
列出所有爬虫:scrapy list
获得配置信息:scrapy settings [options]。

xpath get == extract_first

持久化存储

pipelines.py 参数为item项

持久化存储

从写父类:

def open_spider(self,spider):

def close_spider(self,spider):

开始执行一次

定义多个类

持久化存储
基于终端指令的持久化存储
要求:该种方式只可以将parse方法的返回值存储到本地指定后缀的文本文件中。
执行指令: scrapy crawl spiderName -0 fi LePath
基于管道的持久化存储(重点)
-在爬虫文件中进行数据解析
在items。py中定义相关属性
-步骤1中解析出了几个字段的数据,在此就定义几个属性
在爬虫文件中将解析到的数据存储封装到item类型的对象中
将Item类型的对象提交给管道
在管道文件(pipelines.py) 中,接收爬虫文件提交过来的Item类型对象,且对其进行任意形式的
持久化存储操作
-在配置文件中开启管道机制

手动请求

1
2
yield :  scrapy.Rquest(url=url,callback=self.xxx,meta={'666':'666'})
Form 为post

下载中间件

image-20201017145645879

文件下

xxxPipeline

管道类提供文件下载

image-20201016114510140

大文件下载
下属管道类是sC rapy封装好的我们直接用即可:
from scrapy. pipelines.images import ImagesPipeline
-重写该管道类的三个方法:

​ get_ media requests
​ -对图片地址发起请求
​ file_ path
​ -返回图片名称即可
​ item completed
​ -返回item,将其返回给下一个即将被执行的管道类
在配置文件中添加
IMAGES_ STORE = ‘ dirName ‘

模拟登陆

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class PosttestSpider(scrapy.Spider):
name = 'posttest'
# allowed_domains = ['xxxxx.com']
start_urls = ['http://vip.xxhoz.com/ucenter/login.php']
#######################
#通过手动设置cookie
cookies = {
'Cookie': 'UM_distinctid=171a6c4c9ca280-0c0b194dcd55b9-87f133f-144000-171a6c4c9cb487; PHPSESSID=vgmt904t67ha9mv96oph2q45tk; CNZZDATA1278827165=2035019748-1587636301-null%7C1602920955'
}
def start_requests(self):
start_url ='http://vip.xxhoz.com/ucenter/login.php'
yield scrapy.Request(start_url,callback=self.parse,cookies=self.cookies)
########################
#自动识别表单
def parse(self, response):
yield scrapy.FormRequest.from_response(
response,
formdata={
'u_name':'admin',
'u_password':'admin'
},
callback=self.f
)

def f(self, response):
print(response.text)

########################
#post请求提交
def parse(self, response):
yield scrapy.FormRequest(
url='http://vip.xxhoz.com/ucenter/login.php',
formdata={
'u_name': 'admin',
'u_password':'admin'
},
callback=self.f
)
def f(self, response):
print(response.text)

image-20201016170321810

image-20201017150732737

image-20201017152135089

image-20201017153121824