自动化播放视频
本次我采用Python+selenium写了一个自动播放视频的脚本。 从账号密码登录,切换一个个window,再到切换一层层frame,最终点击播放按钮的过程。 导入包 1234567from selenium import webdriver from selenium.common.exceptions import NoSuchElementExceptionfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.support.wait import WebDriverWaitimport time 将webdriver静音 1234options =...
mysql dataType
String Data Types Data type Description CHAR(size) A FIXED length string (can contain letters, numbers, and special characters). The size parameter specifies the column length in characters - can be from 0 to 255. Default is 1 VARCHAR(size) A VARIABLE length string (can contain letters, numbers, and special characters). The size parameter specifies the maximum column length in characters - can be from 0 to 65535 BINARY(size) Equal to CHAR(), but stores binary byte strings. The size...
Python MySQL
Creating Connection1234567import pymysqlmydb = pymysql.connect( host="localhost", user="root", password="123456") Creating a DatabaseWe created a database named “mydatabase” 123mycursor = mydb.cursor()mycursor.execute("CREATE DATABASE mydatabase") Check if Database Exists12345mycursor = mydb.cursor()mycursor.execute("SHOW DATABASES")for x in mycursor: print(x) access the database when making the connection123456mydb =...
pandas
What is pandas?Pandas is a Python library used for working with data sets. It has functions for analyzing, cleaning, exploring, and manipulating data. SeriesCreating a SeriesYou can create a Series by putting a list or dictionary as the parameter to the method pd.Series() . The Series is a one-dimensional array holding data of any type. labelThe label is the index of the element in the Series. using list1234567import pandas as pda = [1, 7, 2]myvar = pd.Series(a)print(myvar) output 12340 ...
Matplotlib
pyplotMost of the Matplotlib utilities lies under the pyplot submodule, and are usually imported under the plt alias: 1import matplotlib.pyplot as plt Functionplot()The plot() function is used to draw points in a diagram. This function takes two parameters for specifying points in the diagram. Parameter1 is a array that define the range on x-axis. Paramete21 is a array that define the range on y-axis. By default, the plot() function draws a line from point to point. point to...
Regular Expression
IntroductionRegular Expression, is a sequence of characters that forms a search pattern. RegEx can be used to check if a string contains the specified search pattern. RegExMetacharactersMetacharacters are characters with a special meaning: Character Description Example [] A set of characters “[a-m]” \ Signals a special sequence (can also be used to escape special characters) “\d” . Any character (except newline character) “he..o” ^ Starts with “^hello” $ Ends...
Spider
发送请求 获取源码(re正则表达式,css(parsel),XPath) 提取数据 保存数据 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import requestsimport parselimport csvimport timedef spider(): headers={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36' } i=0 num=0 while True: time.sleep(1) ...
Base_syntax
Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed. The way to run a python file is like this on the command line: 1C:\Users\*Your Name*>python helloworld.py Python can be run as a command line itself. Type the following on the Windows, Mac or Linux command line: 1C:\Users\Your Name>python Or, if the “python” command did not work, you can try...
database
Databasecreate database1create database database_name; delete database1drop database database_name; Tablecreate table123456CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, ....); The column parameters specify the names of the columns of the table. The datatype parameter specifies the type of data the column can hold (e.g. varchar, integer, date, etc.). 1234567CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName...
SQL Statement
IntroductionSQL stands for Structured Query Language. SQL lets you access and manipulate database. Using SQL in Your Web SiteTo build a web site that shows data from a database, you will need: An RDBMS database program (i.e. MS Access, SQL Server, MySQL) To use a server-side scripting language, like PHP or ASP To use SQL to get the data you want To use HTML / CSS to style the page DBMSThe data in RDBMS is stored in database objects called tables. A table is a collection of related...
