Skip to content

Instantly share code, notes, and snippets.

/*
list version
*/
class LRUCache {
public:
list<pair<int,int>> q;
unordered_map<int,list<pair<int,int>>::iterator> hash;
list<pair<int,int>>::iterator it;
/*
deque version
Error with test data
["LRUCache","put","put","put","put","get","get"]
[[10],[99,27],[8,10],[6,29],[1,9],[6],[1]]
Because push_front and push_back cause iterator invaild.
*/
from selenium import webdriver
import time
# 關閉通知
options = webdriver.ChromeOptions()
prefs = {
'profile.default_content_setting_values':
{
'notifications': 2
# 全域變數
A = 1
def Sum(X,Y):
global tmp
tmp = X + Y
return tmp
# 呼叫並使用Function
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 12:22:10 2020
@author: Zino
"""
# 印出一列
for j in [1,2,3,4,5]:
print("*", end =" ")
#引入函式庫
import requests
import json
# 超連結
url = 'https://www.google.com.tw/maps/preview/review/listentitiesreviews?authuser=0&hl=zh-TW&gl=tw&pb=!1m2!1y3765758546651144975!2y6093113884180453713!2m2!1i0!2i10!3e2!4m5!3b1!4b1!5b1!6b1!7b1!5m2!1sdzvaXrvAMImImAXHsLPICA!7e81'
# 發送get請求
text = requests.get(url).text
# 取代掉特殊字元,這個字元是為了資訊安全而設定的喔。
pretext = ')]}\''
@linzino7
linzino7 / ddd.py
Created May 28, 2020 18:29
vvdfvdfv
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 00:38:13 2020
@author: ASUS
"""
# 導入 模組(module)
import requests
# 導入 BeautifulSoup 模組(module):解析HTML 語法工具
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 04:38:47 2020
@author: Zino
"""
# 導入 模組(module)
import requests
# 導入 BeautifulSoup 模組(module):解析HTML 語法工具
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 04:38:47 2020
https://medium.com/p/a8216873a9d3
@author: Zino
"""
# 導入 模組(module)
import requests
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 02:46:22 2020
@author: Zino
"""
# 導入 模組(module)
import requests
# 把 到 ptt 八卦版 網址存到URL 變數中