SlideShare una empresa de Scribd logo
1 de 49
Descargar para leer sin conexión
PYTHON でなにできんの?
twitter: @ashigirl96 
あしがる96
113年4月26日金曜日
スクリプト言語
文法が簡単で、読みやすい
モジュールやドキュメントが豊富
やりたいと思うことが(他の言語に比べて)すぐに出来てしまう(かもしれない)
そもそもPythonってなに?
213年4月26日金曜日
事前事項
※別に他の言語をdisったりしてるわけではないのでご了承ください。
権力とかマジこわいんで・・・。
313年4月26日金曜日
PYTHONの紹介
Pythonは オランダ人のすごい人が作りました
彼はPython を 万人が使えるためにした(らしい)
Pythonの目標 :
  簡易で直感な言語で、主要言語と同程度の強力
  オープンソースで誰もが開発可
  平易な英語のようにわかりやすい
  開発時間を極力短くする
                     らしい
413年4月26日金曜日
(続き)
Pythonは ぱいそん と呼びます
Pythonを使ってる人を Pythonista と呼びます (ダサくないです)
Python は ニシキヘビ って意味です
513年4月26日金曜日
インストールしようぜ!
http://www.python.org/download/
OSにあわせてNE !!
613年4月26日金曜日
そろそろ本題に。
713年4月26日金曜日
機械語へ変換する手順を省略して実行出来る言語
スクリプト言語って?
813年4月26日金曜日
それでは、
コンパイル言語 と スクリプト言語 を比較します。
  コンパイル言語は 機械語になおしてから実行します。速いです。
  コンパイル言語で有名なのは C言語(様)です。
913年4月26日金曜日
例
 1 #include<stdio.h>
 2 
 3 int main(void)
 4 {
 5   int a;
 6   char b[]={"@Ashigirl96"};
 7   printf("Hello Worldn");
 8   a=100;
 9   printf("%dn%sn",a,b);
10   
11   return 0;
12 }
C言語 (様)
1013年4月26日金曜日
実行結果 と その行程
ashigirl96% vim c.c [~/Desktop]
ashigirl96% gcc c.c [~/Desktop]
ashigirl96% ./a.out [~/Desktop]
Hello World
100
@Ashigirl96
1113年4月26日金曜日
例
Python (さん)
1 b="@Ashigirl96"
2 print "Hello World"
3 a=100
4 print "%dn%s"%(a,b)
寂しい
1213年4月26日金曜日
実行結果 と その行程
ashigirl96% vim c.py [~/Desktop]
ashigirl96% python c.py [~/Desktop]
Hello World
100
@Ashigirl96
1313年4月26日金曜日
他にも
 1 #include<stdio.h>
 2 
 3 int main(void)
 4 {
 5   int i;
 6   for(i=0;i<10;i++){
 7     printf("Hello Worldn");
 8   }
 9   while(i != 20){
10     printf("@ashigirl96n");
11     i+=1;
12   }
13   return 0;
14 }
15 
1 for i in range(10):
2     print "Hello World"
3 while i!=20:
4     print "@ashigirl96"
5     i+=1
6 
C言語(様) Python
1413年4月26日金曜日
実行結果
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
@ashigirl96
@ashigirl96
@ashigirl96
@ashigirl96
@ashigirl96
@ashigirl96
@ashigirl96 1513年4月26日金曜日
某サイトの某問題
 1 z=lambda:raw_input().split()
 2 while True:
 3     t={}
 4     c=input()
 5     if c==0:break
 6     for i in range(c):
 7         f,q=z()
 8         t[f]=int(q)
 9     for i in range(input()):
10         f=z()
11         m=sum([t[j] if j in t else 0 for j in f[2:]])
12         q=t[f[0]]
13         t[f[0]]=q if m>q else m
14     print t[raw_input()]
C言語(様) Python
1 #include <map>
 2 #include <iostream>
 3 #include <vector>
 4 using namespace std;
 5 map<string,int> item;
 6 map<string,vector<string> > rec;
 7  
 8 int saiki(string str){
 9     int ret = 0;
10     if(rec[str].size()){
11         for(int i=0;i<rec[str].size();i++){
12             ret += saiki(rec[str][i]);
13         }
14     }else{
15         ret=item[str];
16     }
17     if(item[str]&&item[str]<ret)ret=item[str];
18     return ret;
19 }
20  
21 int main(){
22     int n,m,t;
23     string s,rs;
24     while(cin >> n && n){
25         item.clear();
26         rec.clear();
27         for(int i=0;i<n;i++){
28             cin >>    s;
29             cin >> item[s];
30         }
31         cin >> m;
32         for(int i=0;i<m;i++){
33             cin >> rs >> t;
34             for(int j=0;j<t;j++){
35                 cin >> s;
36                 rec[rs].push_back(s);
37             }
38         }
39         cin >> s;
40         cout << saiki(s) << endl;
41     }
42 }
1613年4月26日金曜日
ちなみに、
さっきの問題を(C言語で)解いたのは 我らプロ研の誇りである
   『世界一』の人(部長)。
Pythonで解いたのは僕です。
1713年4月26日金曜日
( ˘⊖˘)。o(C言語って長いし、
  何書いてるか分かりづらいな。)
1813年4月26日金曜日
コレは何の言語ですか?
おぃ!てめぇ!
何C言語 disってんだよ!
例が悪いんだよ殺すぞ!
1913年4月26日金曜日
殺すぞ。
2013年4月26日金曜日
※申し訳ねぇ。
Pythonが良いように書きました。
殺さないでください。
2113年4月26日金曜日
じゃあ見やすいのか。
理由 オブジェクト指向だから。
2213年4月26日金曜日
オブジェクト指向とは
設計や開発で、操作手順より操作対象に重点を置く考え方。
データの集合とそれに対するメソッドを『オブジェクト』として、まとめて、
  組み合わせて何かを作る指向。
2313年4月26日金曜日
よは、
車を作るには、
・タイヤ
・ハンドル
・ボディ
・エンジン
・.etc
   っていう部品(メソッド)で組み合わせて作ろうぜ? っていう指向。
2413年4月26日金曜日
よって、
見やすい
部品(メソッド)で見れるから、組み合わせを変えたら違うものができたり。
2513年4月26日金曜日
オブジェクト指向の言語
Pythonは オブジェクト指向の代表的な言語ですが、
他にも Ruby , Perl , Objective-C , C# などなどたくさんあります!!
2613年4月26日金曜日
インタプリタに話題転換
2713年4月26日金曜日
インタプリタってなんぞ?
ソースコードなしで、実行可!!
1.ソースコードを直接実行する
2.何らかの効率で中間表現にかえ、即座に実行
3.コンパイル済みの中間表現を実行!
例をみよう。
2813年4月26日金曜日
ashigirl96% python [~/Desktop]
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in range(3):
... print i,'Hello World'
...
0 Hello World
1 Hello World
2 Hello World
Python って入れてみ
2913年4月26日金曜日
>>> a = raw_input().split()
100 3000 hoge 340023 asldkfja
>>> print a
['100', '3000', 'hoge', '340023', 'asldkfja']
>>> print a[0]
'100'
>>> a[1]
'3000'
>>> a[2]
'hoge'
>>> a[3]
'340023'
>>>
print はなくても良い
3013年4月26日金曜日
すっごい楽(しい)やろ?
3113年4月26日金曜日
おもんない。話題変えろ
3213年4月26日金曜日
例えば、
奇数の配列(リスト)作る。
『for文で 整数 i を10回まわす、
そのとき i%2(iを2で割った余)が ゼロでない場合の i だけリストに入れる』
Pythonがどれぐらい英語っぽいか
>>>print [i for i in range(10) if i%2 is not 0]
[1, 3, 5, 7, 9]
>>>
3313年4月26日金曜日
続き
もし 文字列に “kyuri” が入っていたら、配列(リスト)から取り除く。
>>> LIST = ['kyuridenamida' , 'homodenamida' , 'kyuri ha sekai iti',
'homo ha sekai iti' , 'butyoukyuri' , 'tatarikun' , 'mossan' ]
>>> print [i for i in LIST if 'kyuri' not in i]
['homodenamida', 'homo ha sekai iti', 'tatarikun', 'mossan']
>>>
これ
3413年4月26日金曜日
ところで、
3513年4月26日金曜日
どうせ、お前も、厨二病だろW
3613年4月26日金曜日
ブラッディ・マンデイも
PYTHONを使ってるよ
3713年4月26日金曜日
あっそ。
話題変えろ
3813年4月26日金曜日
PYTHONで何ができるのか。
3913年4月26日金曜日
Scapyをやりましょう
Scapyってなに?
http://www.slideshare.net/reonnishimura5/scapy-presentation-16806081←解説してます(ごめんなさい
Scapyは Pythonによって作られた パケット生成ツール
ネットワークについて勉強したい人は必ずやっておくべきです!!
ネットワーク興味ある方
4013年4月26日金曜日
こういう感じのやつです。
4113年4月26日金曜日
Pythonでバイナリ解析できるらしいです。
結構知識が必要です、めっちゃ必要です。けど楽しいです。
➡この本が良いです。僕は今の所(理解して)読めないです。
リバースエンジニアリング ―Pythonによるバイナリ解析技法 (Art Of Reversing) 
セキュリティに興味ある方
4213年4月26日金曜日
こういう感じのやつです。
4313年4月26日金曜日
Google App Engine っていうGoogleが提供してるサービスで、
 Python,Java,Goなどの言語で、作ることが出来ます。
Python用SDK(ソフトデベロップキット)などもあるので、
 調べてみたら簡単に作れると思います。
Webアプリ制作に興味ある方
4413年4月26日金曜日
Django っていうPythonのwebフレームワークがあります。
簡単に好きなサイトが作れてしまいます。
開発やテスト用の軽量サーバなども提供されてます。
データベースの言語も色々使えて便利です。
Webサイトに興味ある方
4513年4月26日金曜日
Pygame を調べてみましょう
ビデオゲームを作るために制作されたモジュールのことです。
チュートリアル(説明)がたくさんあるので、勉強しやすいです。
ゲーム制作に興味ある方
4613年4月26日金曜日
こういう感じのやつです。
http://www.pygame.org/project-Spacemax-1698-3491.html
4713年4月26日金曜日
このようにたくさんできることがあります。
もしなにからしていいかわからない。
けどプログラミングしたい。
そんな方はPYTHONがおすすめです。
4813年4月26日金曜日
ご清聴ありがとうございました!
4913年4月26日金曜日

Más contenido relacionado

La actualidad más candente

Python入門者の集い #6 Lightning Talk
Python入門者の集い #6 Lightning Talk Python入門者の集い #6 Lightning Talk
Python入門者の集い #6 Lightning Talk Katayanagi Nobuko
 
Python界隈の翻訳プロジェクト
Python界隈の翻訳プロジェクトPython界隈の翻訳プロジェクト
Python界隈の翻訳プロジェクトTetsuya Morimoto
 
Pythonのプロファイリング
PythonのプロファイリングPythonのプロファイリング
Pythonのプロファイリングysakaguchi
 
S10 t1 spc_by_nowfromnow
S10 t1 spc_by_nowfromnowS10 t1 spc_by_nowfromnow
S10 t1 spc_by_nowfromnowTakeshi Akutsu
 
From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...
From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...
From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...Kiyoshi Ogawa
 
簡易TRPG向けチャットツールOnset!
簡易TRPG向けチャットツールOnset!簡易TRPG向けチャットツールOnset!
簡易TRPG向けチャットツールOnset!kiridaruma
 
191208 python-kansai-nishimoto
191208 python-kansai-nishimoto191208 python-kansai-nishimoto
191208 python-kansai-nishimotoTakuya Nishimoto
 
プログラミング学習とScratch raspi python
プログラミング学習とScratch raspi pythonプログラミング学習とScratch raspi python
プログラミング学習とScratch raspi pythonYoshitaka Shiono
 
S16 t1 python学習奮闘記#6
S16 t1 python学習奮闘記#6S16 t1 python学習奮闘記#6
S16 t1 python学習奮闘記#6Takeshi Akutsu
 
「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」Takeshi Akutsu
 
オリエンテーション
オリエンテーションオリエンテーション
オリエンテーションTakeshi Akutsu
 
鳥取python勉強会 第2回
鳥取python勉強会 第2回鳥取python勉強会 第2回
鳥取python勉強会 第2回Yuji Oyamada
 

La actualidad más candente (20)

Python入門者の集い #6 Lightning Talk
Python入門者の集い #6 Lightning Talk Python入門者の集い #6 Lightning Talk
Python入門者の集い #6 Lightning Talk
 
Python界隈の翻訳プロジェクト
Python界隈の翻訳プロジェクトPython界隈の翻訳プロジェクト
Python界隈の翻訳プロジェクト
 
Pythonのプロファイリング
PythonのプロファイリングPythonのプロファイリング
Pythonのプロファイリング
 
S10 t1 spc_by_nowfromnow
S10 t1 spc_by_nowfromnowS10 t1 spc_by_nowfromnow
S10 t1 spc_by_nowfromnow
 
From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...
From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...
From Scratch, let's start Deep Learning with Python (plus Text Processing, pr...
 
Python
PythonPython
Python
 
S09 t0 orientation
S09 t0 orientationS09 t0 orientation
S09 t0 orientation
 
簡易TRPG向けチャットツールOnset!
簡易TRPG向けチャットツールOnset!簡易TRPG向けチャットツールOnset!
簡易TRPG向けチャットツールOnset!
 
S13 t0 introduction
S13 t0 introductionS13 t0 introduction
S13 t0 introduction
 
Introduction
IntroductionIntroduction
Introduction
 
S03 t0 get_started
S03 t0 get_startedS03 t0 get_started
S03 t0 get_started
 
191208 python-kansai-nishimoto
191208 python-kansai-nishimoto191208 python-kansai-nishimoto
191208 python-kansai-nishimoto
 
プログラミング学習とScratch raspi python
プログラミング学習とScratch raspi pythonプログラミング学習とScratch raspi python
プログラミング学習とScratch raspi python
 
S16 t1 python学習奮闘記#6
S16 t1 python学習奮闘記#6S16 t1 python学習奮闘記#6
S16 t1 python学習奮闘記#6
 
「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」「長野で語るStapyのビジョン」
「長野で語るStapyのビジョン」
 
オリエンテーション
オリエンテーションオリエンテーション
オリエンテーション
 
S01 t0 orientation
S01 t0 orientationS01 t0 orientation
S01 t0 orientation
 
鳥取python勉強会 第2回
鳥取python勉強会 第2回鳥取python勉強会 第2回
鳥取python勉強会 第2回
 
S05_T0_orientation
S05_T0_orientationS05_T0_orientation
S05_T0_orientation
 
S10 t0 orientation
S10 t0 orientationS10 t0 orientation
S10 t0 orientation
 

Python begin