- 例外処理
try:
print("hogehoge")
except Exception as e:
print(e)
| # coding: utf-8 | |
| import argparse | |
| import numpy as np | |
| from sklearn import svm | |
| from sklearn.multiclass import OneVsRestClassifier | |
| from sklearn.externals import joblib | |
| parser = argparse.ArgumentParser(description="svm") | |
| parser.add_argument("-pretrained_model", default=None) | |
| parser.add_argument("-train", default=None, help="data for train") |
| import numpy as np | |
| import caffe | |
| PROTOTEXT = "VGG_FACE_deploy.prototxt" | |
| CAFFEMODEL = "VGG_FACE.caffemodel" | |
| IMG_PATH = "ma_images/" | |
| IMG_FILES = os.listdir(IMG_PATH) | |
| OUTPUT_FILE = "train.csv" | |
| #OUTPUT_FILE = "test.csv" |
| # coding: utf-8 | |
| import sys | |
| import numpy as np | |
| VALID_COLUMNS = [] | |
| def main(): | |
| inputfile = sys.argv[1] | |
| outputfile = sys.argv[2] | |
| valid_columns_csv = sys.argv[3] |
| FROM java:7-jre | |
| # grab gosu for easy step-down from root | |
| RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 | |
| RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ | |
| && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ | |
| && gpg --verify /usr/local/bin/gosu.asc \ | |
| && rm /usr/local/bin/gosu.asc \ | |
| && chmod +x /usr/local/bin/gosu |
| #!/bin/bash | |
| lzos=*.lzo | |
| for LZO in ${lzos} | |
| do | |
| echo ${LZO} | |
| lzop -x ${LZO} | |
| rm `echo ${LZO%.*}'.*'` | |
| done |
| import MySQLdb | |
| connector = MySQLdb.connect(host="localhost", db="dbname", user="user", passwd="paswd", charset="utf8") | |
| cursor = connector.cursor() | |
| cursor.execute("select * from table limit 100") | |
| result = cursor.fetchall() | |
| if len(result) == 0: | |
| print("no arecords. exit.") | |
| cursor.close() |
| import urllib | |
| from BeautifulSoup import BeautifulStoneSoup | |
| NUM = 1 | |
| url = 'http://www.hogehoge.com?' | |
| params = { | |
| 'param1':'para', | |
| 'param2': 'para' | |
| } |
| import urllib | |
| import json | |
| NUM = 1 | |
| url = 'https://www.hogehoge.com?' | |
| params = { | |
| 'param1':'para', | |
| 'param2':'para', | |
| } | |
| f = open('hogehoge.json','w') |
| <?PHP | |
| // 全角英数字と全角スペースを半角に変換 | |
| $input_term = mb_convert_kana($input_term, 'as', 'UTF-8'); | |
| // 連続する半角スペースを1つの半角スペースへ | |
| $input_term = preg_replace('/\s+/', ' ', $input_term); |