Add pause.cpp
This commit is contained in:
parent
b589e17486
commit
12c8284767
@ -11,7 +11,9 @@
|
||||
|LAN++|./lanpp|一个跨平台的简易局域网文件传输工具|Python|
|
||||
|Plane Fighting|./plane_fighting|一个跨平台的简易"飞机大战"小游戏|Python|
|
||||
|Python HTTPS Server|./python_https_server|一个 HTTPS 网络服务器程序|Python|
|
||||
|Juan|./juan|获取 http://www.zxx.edu.cn 的公开的用户学习数据并制作成图表, 看看人们有多卷|Python|
|
||||
### 单文件 (onefile)
|
||||
|文件名|介绍|语言|
|
||||
|----|----|----|
|
||||
|file_reader.cpp|输出文件内容至终端|C++|
|
||||
|pause.cpp|按任意键继续|C++|
|
||||
|
44
juan/creater.py
Normal file
44
juan/creater.py
Normal file
@ -0,0 +1,44 @@
|
||||
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||
import bs4, time, datetime
|
||||
|
||||
def addtofile(path, data):
|
||||
with open(path, 'a', encoding='UTF-8') as f:
|
||||
f.write(data)
|
||||
f.close()
|
||||
|
||||
def access(playwright: Playwright) -> None:
|
||||
browser = playwright.chromium.launch(headless=True)
|
||||
context = browser.new_context()
|
||||
# Open new page
|
||||
while True:
|
||||
print("Exploring")
|
||||
page = context.new_page()
|
||||
# Go to https://www.zxx.edu.cn/
|
||||
page.goto("https://www.zxx.edu.cn/")
|
||||
page.wait_for_load_state('networkidle')
|
||||
html = page.content()
|
||||
# Close page
|
||||
page.close()
|
||||
# ---------------------
|
||||
context.close()
|
||||
browser.close()
|
||||
soup = bs4.BeautifulSoup(html, 'html.parser')
|
||||
text = soup.text
|
||||
p_f = text.index("做眼保健操今天已有")
|
||||
p_e = text.index("人与你一起学习")
|
||||
t_f = text.index("你们共浏览了")
|
||||
t_e = text.index("次。主办")
|
||||
person = text[p_f+9:p_e]
|
||||
person = int(person.replace(",",""))
|
||||
times = text[t_f+6:t_e]
|
||||
times = int(times.replace(",",""))
|
||||
print("Person: " + str(person))
|
||||
print("Times: " + str(times))
|
||||
total = [person, times, datetime.datetime.now().strftime('%Y-%m-%d')]
|
||||
addtofile("data.txt",str(total) + "\n")
|
||||
print("Data added completed")
|
||||
time.sleep(300)
|
||||
|
||||
|
||||
with sync_playwright() as playwright:
|
||||
access(playwright)
|
1
juan/data.txt
Normal file
1
juan/data.txt
Normal file
@ -0,0 +1 @@
|
||||
[22821, 105404, '2022-04-20']
|
0
juan/geckodriver.log
Normal file
0
juan/geckodriver.log
Normal file
10
juan/reader.py
Normal file
10
juan/reader.py
Normal file
@ -0,0 +1,10 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
f = open("data.txt", "r")
|
||||
a = 0
|
||||
while a == 0:
|
||||
f.readline
|
||||
x = np.linspace(10., 100., 50)
|
||||
y = x**10 + x**5 + x**2 + 100
|
||||
plt.plot(x, y)
|
||||
plt.show()
|
12
onefile/pause.cpp
Normal file
12
onefile/pause.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// pause.cpp
|
||||
// LICENSE: Nothing(do what ever you want!)
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
cout << "Press any key to continue...";
|
||||
cin.clear();
|
||||
cin.sync();
|
||||
cin.get();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user