• Skip to main content
  • Skip to primary sidebar

学習記録

コメントアウトのショートカット

2017年10月16日 by 河副 太智 Leave a Comment

コメントアウトしたい部分を選択して、
「Ctrl + /」(Windowsの場合)

Filed Under: python3 Tagged With: コメントアウト

虫眼鏡フォーム

2017年10月16日 by 河副 太智 Leave a Comment

http://www.tagindex.com/template/form/textbox2.html

Filed Under: python3 Tagged With: form, フォーム, 虫眼鏡

プルダウンメニュー

2017年10月16日 by 河副 太智 Leave a Comment

http://www.tagindex.com/html5/form/select.html

Filed Under: python3 Tagged With: フォーム, プルダウン

hsの変換(途中)インテンドで苦労する

2017年10月14日 by 河副 太智 Leave a Comment

import sys
import io
import csv
import codecs
import cgi

 

sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
print('Content-type: text/html; charset=UTF-8\r\n')
print('2017年度HSコードを旧HSコードに変換<BR><BR>')

# 含まれないのでフォームを表示
form = cgi.FieldStorage()
if (not 'v1' in form):
# 含まれないのでフォームを表示
print("""
<form>
<input type="text" name="v1">
<input type="submit" value="aa">
</form>
""")
else:
# # フォームの値を取得して計算結果を表示 --- (*2)
v1 = form.getvalue("v1", "0")
# v2 = form.getvalue("v2", "0")
ans = str(v1)

# Shift_JISのCSVファイルを読む
filename = "2017toHS2012.csv"
csv = codecs.open(filename, "r", "shift_jis").read()

 

# # CSVをPythonのリストに変換する
#
data = []
rows = csv.split("\r\n")
for row in rows:
if row == "": continue
cells = row.split(",")
data.append(cells)

for c in data:
if ans == c[0]:
print("2017年度のHSコード",c[0],"は<br>","2012年度において<b>",c[1],"</b>となっております")
break

print("指定のコードは存在しません")

Filed Under: Python 基本

日本語にすると505エラー

2017年10月4日 by 河副 太智 Leave a Comment

#!/usr/bin/env python3
# coding: utf-8

import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding=’utf-8′)
print(‘Content-type: text/html; charset=UTF-8\r\n’)

と記述すれば日本語も表示される

Filed Under: python3

webアプリ 一番簡単なpython

2017年9月30日 by 河副 太智 Leave a Comment

http://hukumoto.pe-gawa.com/news/%E3%82%A8%E3%83%83%E3%82%AF%E3%82%B9%E3%82%B5%E3%83%BC%E3%83%90%E3%81%A7%E3%80%81perl%E3%83%BBruby%E3%83%BBpython%E3%82%92%E5%8B%95%E3%81%8B%E3%81%99%E3%80%82

 

 

●pythonを動かす。

1、test.pyを作成します。

1
2
3
4
5
#!/usr/bin/python
# coding: shift_jis
print "Content-Type: text/html\n\n"
print "python!!!!"
 

2、test.pyのパーミッションを705に変更します。
3、.htaccessを作成し、
AddHandler cgi-script .py
を書いて保存。

これで。pythonが動くようになりました。

Filed Under: python3

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 58
  • Page 59
  • Page 60
  • Page 61
  • Page 62
  • Interim pages omitted …
  • Page 66
  • Go to Next Page »

Primary Sidebar

カテゴリー

  • AWS
  • Bootstrap
  • Dash
  • Django
  • flask
  • GIT(sourcetree)
  • Plotly/Dash
  • VPS
  • その他tool
  • ブログ
  • プログラミング
    • Bokeh
    • css
    • HoloViews
    • Jupyter
    • Numpy
    • Pandas
    • PosgreSQL
    • Python 基本
    • python3
      • webアプリ
    • python3解説
    • scikit-learn
    • scipy
    • vps
    • Wordpress
    • グラフ
    • コマンド
    • スクレイピング
    • チートシート
    • データクレンジング
    • ブロックチェーン
    • 作成実績
    • 時系列分析
    • 機械学習
      • 分析手法
      • 教師有り
    • 異常値検知
    • 自然言語処理
  • 一太郎
  • 数学
    • sympy
      • 対数関数(log)
      • 累乗根(n乗根)
    • 暗号学

Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in