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 cv2 | |
import numpy as np | |
size = 100, 100, 3 | |
red_img = np.zeros(size, dtype=np.uint8) | |
cv2.imshow('result',red_img) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
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
require 'open-uri' | |
require 'uri' | |
url = 'https://www.google.co.jp/search?q=シャドウバース リセマラ' | |
url_escape = URI.escape(url) | |
user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.63 Safari/537.36' | |
charset = nil | |
html = open(url_escape, "User-Agent" => user_agent) do |f| | |
charset = f.charset | |
f.read |
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
require 'open-uri' | |
require 'nokogiri' | |
url = 'http://www.tcu.ac.jp/topics/index.html' # 大学のURL | |
doc = Nokogiri::HTML(open(url)) # urlの読み込み | |
p doc.css('.topics-entrytitle').inner_text # お知らせの一覧 | |
p doc.css('.entrydate').inner_text # お知らせが投稿された日 |
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
#URLにアクセスするためのライブラリを読み込む | |
require 'open-uri' | |
#nokogiriの呼び出し | |
require 'nokogiri' | |
#読み込みたいurlを記述する | |
url='http://www.tcu.ac.jp/topics/index.html' | |
charset=nil | |
html = open(url) do |f| |