This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageFilter | |
# Blur Filter | |
im = Image.open("cat.jpg") | |
im.filter(ImageFilter.BLUR) | |
im.save("cat-blur.jpg") | |
# Edge Enhance Filter | |
im = Image.open("cat.jpg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
# Macだとプレビューで開く | |
im = Image.open("cat.jpg") | |
print(im.mode) | |
print(im.size) | |
print(im.width) | |
print(im.height) | |
im.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
url = "http://www.yahoo.co.jp" | |
options = Options() | |
options.add_argument("--headless") | |
options.add_argument("--no-sandbox") | |
driver = webdriver.Chrome("/usr/bin/chromedriver", options=options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%shell | |
# Ubuntu no longer distributes chromium-browser outside of snap | |
# | |
# Proposed solution: https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap | |
# Add debian buster | |
cat > /etc/apt/sources.list.d/debian.list <<'EOF' | |
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster.gpg] http://deb.debian.org/debian buster main | |
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster-updates.gpg] http://deb.debian.org/debian buster-updates main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from datetime import datetime | |
def function(i): | |
print(f"実行: {i}回目 ({datetime.now()})") | |
max_num = 5 | |
wait_time = 0.5 | |
for i in range(max_num): | |
time.sleep(wait_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from datetime import datetime | |
print(f"1行目 {datetime.now()}") | |
time.sleep(1) | |
print(f"2行目 {datetime.now()}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x, y, z = map(int, input().split()) | |
print(f"x={x}, y={y}, z={z}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("数値を入力してください:", end="") | |
x = input() | |
try: | |
x = int(x) | |
print(f"入力(数値):{x}") | |
except ValueError: | |
print(f"入力エラー:{x}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("入力してください:", end="") | |
x = input() | |
print(f"入力:{x}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l = [ | |
(1, 10), | |
(5, 8), | |
(2, -5), | |
(4, -3), | |
(3, 6) | |
] | |
NewerOlder