SlideShare uma empresa Scribd logo
1 de 20
Hello World
Python featuring GAE
      maito kuwahara
a table of contents
•   自己紹介          •   タプル

•   なぜPython?     •   ディクショナリ

•   なぜGAE?        •   if文

•   Pythonの起動方法   •   forループ

•   Pythonの終了方法   •   関数

•   HelloWorld    •   import
•   変数            •   class

•   文字列           •   hello world using GAE

•   数値

•   リスト
自己紹介
•   maito kuwahara
•   twitter @maito
•   facebook https://www.facebook.com/maitokuwahara
•   Blog http://temping-amagramer.blogspot.jp/
•   2006年∼2010年 日本ソフトウエア株式会社 SE(ColdFusion Oracle HTML JS CSS)

•   2010年∼           NHNJapan                    RIA(JavaScript PHP)

•   私生活では、、、 Python Objective-C PHP scheme Cなどなど。

•   本格的なプログラミングは、就職後。
なぜPython
•   ずばり、GoogleAppEngineの魅力
なぜGoogleAppEngine
•   Googleのアカウントを持っていたので、複雑な登録作業不要

•   RDBMSではないが、DBが使用可

•   他のレンタルサーバーと違い、無料
Pythonの起動方法
•   for mac                      テキスト




    •   ターミナルを起動

    •   pythonと入力し、Enter

•   for windows

    •   コマンドプロンプトを起動

    •   cdコマンドでpython.exeファイルが
        あるところまでディレクトリを移動

    •   pythonと入力し、Enter
Pythonの終了方法
•   exit()を入力   テキスト




•   enter
                テキスト
Hello World
•   print “hello world”と入力してEnter

    >>> print "hello world"
    hello world

•   print “hello yoyogi.py”と入力してEnter

    >>> print "hello yoyogi.py"
    hello yoyogi.py

•   print 3.14と入力してEnter

    >>> print 3.14
    3.14
変数
•   文字列、数値、リストなどの値を格納する容器

    ex)
    >>> hoge = 'today is 3rd yoyogi.py'
    >>> print hoge
    today is 3rd yoyogi.py

•   変数名は、英数字かつ、先頭文字は、英単語

•   一部の名前については、使用不可

    ex)
    if、for、class、tryなどなど
文字列
•   英単語、日本語、数字、記号などの文字の組み合わせ

•   変数に設定するときは、「‘」または「“」で囲む必要が有り

•   文字列同士を繋げたい場合は、「+」で接続
ex1)
>>> foo = 'greed'
>>> print foo
greed
ex2)
>>> foo = "greed " + " is " + " good "
>>> print foo
greed is good
ex3)
>>> foo = "I "
>>> bar = " study "
>>> hoge = " python"
>>> result = foo + bar + hoge
>>> print result
I study python
数値
•   数字とカンマ「.」で構成

•   四則演算可能

•   文字列と連結は、NG

ex)
NG Pattern
>>> love = "akihabara" + 48
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'int' objects
OK Pattern
>>> love = "akihabara " + str(48)
>>> print love
akihabara 48
リスト
•   文字、数値などで構成される集合体

•   indexの指定により、リストの各要素を取得可能

•   indexの先頭は、0

•   要素毎の更新可能

ex)
hoge = ["today","is",5,22]
>>> print hoge
['today', 'is', 5, 22]
>>> print hoge[1]
is
>>> hoge[2] = 6
>>> print hoge
['today', 'is', 6, 22]
タプル
•   文字、数値などで構成される集合体

•   indexの指定により、リストの各要素を取得可能

•   indexの先頭は、0

•   要素毎の更新不可
ex)
hoge = ("today","is",5,22)
>>> print hoge
('today', 'is', 5, 22)
>>> print hoge[1]
is
>>> hoge[2] = 6
>>> print hoge
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
ディクショナリ
•   key(キー)とvalue(文字、数値などで)構成される集合体

•   keyの指定により、ディクショナリの各要素を取得可能

•   要素毎の更新可能

ex)
hoge = {'x':3,'y':"foo",'z':8}
>>> print hoge['x']
3
>>> hoge['y'] = 'bar'
>>> print hoge['y']
bar
if文
•   ある条件をクリアーした場合に、特定の処理を実行

ex)
>>> hoge = [3,"foo",8]
>>> #最後に「:」が必要
>>> if hoge[0] > 3:
... #インデントを必ず行う
... print "check it"
... #3以下の場合に実行される
... else:
... print "come on"
...
come on
for文
•   繰り返し処理を行いたい場合に使用

ex1)
>>> hoge = [3,"foo",8]
>>> #最後に「:」が必要
>>> for i in hoge:
... print i
...
3
foo
8
ex2)
>>> #rangeは関数
>>> for i in range(3):
... print i
...
0
1
2
関数
•   ある特定の処理を実行してもらう機能

ex1)
>>> def foo(args):
... print args
...
>>> foo('call me')
call me

ex2)
>>> def foo(args):
... return "take" + args
...
>>> ret = foo(' my breath away')
>>> print ret
take my breath away
import
•   ある特定のプログラムの集まりを使用可能な状態に変更

ex1)
>>> #乱数を出力するrandomパッケージをimport
>>> import random
>>> print random.random()
0.537642900846
ex2)
>>> #数字関連を扱うmathパッケージをimport
>>> import math
>>> math.ceil(1.45)
2.0
>>> #日付関連を扱うdatetimeパッケージをimport
>>> import datetime
>>> d = datetime.datetime.today()
>>> print d
2012-05-21 19:27:54.178793
class
•   ある特定のプログラムの集合体
ex1)
>>> class hoge():
... def sayHallo(self,args):
...       print "hello " + args
...
>>> foo = hoge()
>>> foo.sayHallo('yoyogi')
hello yoyogi
ex2)
>>> class hoge():
... def sayHallo(self):
...       print "hello " + self.name
... def setName(self,args):
...       self.name = args
...
>>> foo = hoge()
>>> foo.setName('tokyo')
>>> foo.sayHallo()
hello tokyo
hello world using GAE
• demo

Mais conteúdo relacionado

Mais procurados

Easy caching and logging package using annotation in Python
Easy caching and logging package using annotation in PythonEasy caching and logging package using annotation in Python
Easy caching and logging package using annotation in PythonYasunori Horikoshi
 
みんなのPython勉強会#77 パッケージングしよう
みんなのPython勉強会#77 パッケージングしようみんなのPython勉強会#77 パッケージングしよう
みんなのPython勉強会#77 パッケージングしようAtsushi Odagiri
 
Boostライブラリ一周の旅
Boostライブラリ一周の旅 Boostライブラリ一周の旅
Boostライブラリ一周の旅 Akira Takahashi
 
One - Common Lispでもワンライナーしたい
One - Common LispでもワンライナーしたいOne - Common Lispでもワンライナーしたい
One - Common Lispでもワンライナーしたいt-sin
 
Lisp tutorial for Pythonista : Day 1
Lisp tutorial for Pythonista : Day 1Lisp tutorial for Pythonista : Day 1
Lisp tutorial for Pythonista : Day 1Ransui Iso
 
Inquisitor -Common Lispに文字コード判定を-
Inquisitor -Common Lispに文字コード判定を-Inquisitor -Common Lispに文字コード判定を-
Inquisitor -Common Lispに文字コード判定を-t-sin
 
Enumはデキる子 ~ case .Success(let value): ~
 Enumはデキる子 ~ case .Success(let value): ~ Enumはデキる子 ~ case .Success(let value): ~
Enumはデキる子 ~ case .Success(let value): ~Takaaki Tanaka
 
Pythonとパッケージングと私
Pythonとパッケージングと私Pythonとパッケージングと私
Pythonとパッケージングと私Atsushi Odagiri
 
私がPerlを使う理由
私がPerlを使う理由私がPerlを使う理由
私がPerlを使う理由Yohei Azekatsu
 
eggとはなんだったのか 栄光のsetuptools
eggとはなんだったのか 栄光のsetuptoolseggとはなんだったのか 栄光のsetuptools
eggとはなんだったのか 栄光のsetuptoolsAtsushi Odagiri
 
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.kiki utagawa
 
Haskell超初心者勉強会11
Haskell超初心者勉強会11Haskell超初心者勉強会11
Haskell超初心者勉強会11Takashi Kawachi
 
Sounds Like Common Lisp - ゼロからはじめるサウンドプログラミング
Sounds Like Common Lisp - ゼロからはじめるサウンドプログラミングSounds Like Common Lisp - ゼロからはじめるサウンドプログラミング
Sounds Like Common Lisp - ゼロからはじめるサウンドプログラミングt-sin
 
Python東海Vol.5 IPythonをマスターしよう
Python東海Vol.5 IPythonをマスターしようPython東海Vol.5 IPythonをマスターしよう
Python東海Vol.5 IPythonをマスターしようHiroshi Funai
 
Effective python #5, #6
Effective python #5, #6Effective python #5, #6
Effective python #5, #6bontakun
 
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」Nagi Teramo
 
すごいHaskell読書会#10
すごいHaskell読書会#10すごいHaskell読書会#10
すごいHaskell読書会#10Shin Ise
 

Mais procurados (20)

Easy caching and logging package using annotation in Python
Easy caching and logging package using annotation in PythonEasy caching and logging package using annotation in Python
Easy caching and logging package using annotation in Python
 
みんなのPython勉強会#77 パッケージングしよう
みんなのPython勉強会#77 パッケージングしようみんなのPython勉強会#77 パッケージングしよう
みんなのPython勉強会#77 パッケージングしよう
 
Boostライブラリ一周の旅
Boostライブラリ一周の旅 Boostライブラリ一周の旅
Boostライブラリ一周の旅
 
One - Common Lispでもワンライナーしたい
One - Common LispでもワンライナーしたいOne - Common Lispでもワンライナーしたい
One - Common Lispでもワンライナーしたい
 
Lisp tutorial for Pythonista : Day 1
Lisp tutorial for Pythonista : Day 1Lisp tutorial for Pythonista : Day 1
Lisp tutorial for Pythonista : Day 1
 
Inquisitor -Common Lispに文字コード判定を-
Inquisitor -Common Lispに文字コード判定を-Inquisitor -Common Lispに文字コード判定を-
Inquisitor -Common Lispに文字コード判定を-
 
Subprocess no susume
Subprocess no susumeSubprocess no susume
Subprocess no susume
 
Enumはデキる子 ~ case .Success(let value): ~
 Enumはデキる子 ~ case .Success(let value): ~ Enumはデキる子 ~ case .Success(let value): ~
Enumはデキる子 ~ case .Success(let value): ~
 
Pythonとパッケージングと私
Pythonとパッケージングと私Pythonとパッケージングと私
Pythonとパッケージングと私
 
私がPerlを使う理由
私がPerlを使う理由私がPerlを使う理由
私がPerlを使う理由
 
eggとはなんだったのか 栄光のsetuptools
eggとはなんだったのか 栄光のsetuptoolseggとはなんだったのか 栄光のsetuptools
eggとはなんだったのか 栄光のsetuptools
 
C-langage
C-langageC-langage
C-langage
 
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
Pythonの処理系はどのように実装され,どのように動いているのか? 我々はその実態を調査すべくアマゾンへと飛んだ.
 
Haskell超初心者勉強会11
Haskell超初心者勉強会11Haskell超初心者勉強会11
Haskell超初心者勉強会11
 
Sounds Like Common Lisp - ゼロからはじめるサウンドプログラミング
Sounds Like Common Lisp - ゼロからはじめるサウンドプログラミングSounds Like Common Lisp - ゼロからはじめるサウンドプログラミング
Sounds Like Common Lisp - ゼロからはじめるサウンドプログラミング
 
Python東海Vol.5 IPythonをマスターしよう
Python東海Vol.5 IPythonをマスターしようPython東海Vol.5 IPythonをマスターしよう
Python東海Vol.5 IPythonをマスターしよう
 
Effective python #5, #6
Effective python #5, #6Effective python #5, #6
Effective python #5, #6
 
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
「plyrパッケージで君も前処理スタ☆」改め「plyrパッケージ徹底入門」
 
すごいHaskell読書会#10
すごいHaskell読書会#10すごいHaskell読書会#10
すごいHaskell読書会#10
 
Python yield
Python yieldPython yield
Python yield
 

Destaque

Create first-web application-googleappengine
Create first-web application-googleappengineCreate first-web application-googleappengine
Create first-web application-googleappenginemarwa Ayad Mohamed
 
How to django at first
How to django at firstHow to django at first
How to django at firstMaito Kuwahara
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A GlanceStefan Christoph
 
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Naga Rohit
 
Announcing Databricks Cloud (Spark Summit 2014)
Announcing Databricks Cloud (Spark Summit 2014)Announcing Databricks Cloud (Spark Summit 2014)
Announcing Databricks Cloud (Spark Summit 2014)Databricks
 
Platform as a Service with Kubernetes and Mesos
Platform as a Service with Kubernetes and Mesos Platform as a Service with Kubernetes and Mesos
Platform as a Service with Kubernetes and Mesos Miguel Zuniga
 
Spark Summit San Francisco 2016 - Ali Ghodsi Keynote
Spark Summit San Francisco 2016 - Ali Ghodsi KeynoteSpark Summit San Francisco 2016 - Ali Ghodsi Keynote
Spark Summit San Francisco 2016 - Ali Ghodsi KeynoteDatabricks
 
Data Science in the Cloud with Spark, Zeppelin, and Cloudbreak
Data Science in the Cloud with Spark, Zeppelin, and CloudbreakData Science in the Cloud with Spark, Zeppelin, and Cloudbreak
Data Science in the Cloud with Spark, Zeppelin, and CloudbreakDataWorks Summit
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Enginerajdeep
 
Google app engine
Google app engineGoogle app engine
Google app engineSuraj Mehta
 
15 Years of Apple's Homepage
15 Years of Apple's Homepage15 Years of Apple's Homepage
15 Years of Apple's HomepageCharlie Hoehn
 
Photoshopショートカット入門1:基本ツール編
Photoshopショートカット入門1:基本ツール編Photoshopショートカット入門1:基本ツール編
Photoshopショートカット入門1:基本ツール編Yutaka Hayashi
 

Destaque (17)

Create first-web application-googleappengine
Create first-web application-googleappengineCreate first-web application-googleappengine
Create first-web application-googleappengine
 
How to django at first
How to django at firstHow to django at first
How to django at first
 
Python Gae django
Python Gae djangoPython Gae django
Python Gae django
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A Glance
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
 
Desarrollo con JSF
Desarrollo con JSFDesarrollo con JSF
Desarrollo con JSF
 
Announcing Databricks Cloud (Spark Summit 2014)
Announcing Databricks Cloud (Spark Summit 2014)Announcing Databricks Cloud (Spark Summit 2014)
Announcing Databricks Cloud (Spark Summit 2014)
 
PuttingItAllTogether
PuttingItAllTogetherPuttingItAllTogether
PuttingItAllTogether
 
Platform as a Service with Kubernetes and Mesos
Platform as a Service with Kubernetes and Mesos Platform as a Service with Kubernetes and Mesos
Platform as a Service with Kubernetes and Mesos
 
Spark Summit San Francisco 2016 - Ali Ghodsi Keynote
Spark Summit San Francisco 2016 - Ali Ghodsi KeynoteSpark Summit San Francisco 2016 - Ali Ghodsi Keynote
Spark Summit San Francisco 2016 - Ali Ghodsi Keynote
 
Data Science in the Cloud with Spark, Zeppelin, and Cloudbreak
Data Science in the Cloud with Spark, Zeppelin, and CloudbreakData Science in the Cloud with Spark, Zeppelin, and Cloudbreak
Data Science in the Cloud with Spark, Zeppelin, and Cloudbreak
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Google app engine
Google app engineGoogle app engine
Google app engine
 
15 Years of Apple's Homepage
15 Years of Apple's Homepage15 Years of Apple's Homepage
15 Years of Apple's Homepage
 
Photoshopショートカット入門1:基本ツール編
Photoshopショートカット入門1:基本ツール編Photoshopショートカット入門1:基本ツール編
Photoshopショートカット入門1:基本ツール編
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 

Semelhante a Hello World Python featuring GAE

Python Kyoto study
Python Kyoto studyPython Kyoto study
Python Kyoto studyNaoya Inada
 
JavaScript 講習会 #1
JavaScript 講習会 #1JavaScript 講習会 #1
JavaScript 講習会 #1Susisu
 
PEP8を読んでみよう
PEP8を読んでみようPEP8を読んでみよう
PEP8を読んでみよう2bo 2bo
 
2017/12/21 虎の穴 Python勉強会
2017/12/21 虎の穴 Python勉強会2017/12/21 虎の穴 Python勉強会
2017/12/21 虎の穴 Python勉強会虎の穴 開発室
 
Pythonで始めるDropboxAPI
Pythonで始めるDropboxAPIPythonで始めるDropboxAPI
Pythonで始めるDropboxAPIDaisuke Igarashi
 
DATUM STUDIO PyCon2016 Turorial
DATUM STUDIO PyCon2016 TurorialDATUM STUDIO PyCon2016 Turorial
DATUM STUDIO PyCon2016 TurorialTatsuya Tojima
 
「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12
「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12
「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12Takanori Suzuki
 
FP習熟度レベルとFSharpxのIteratee
FP習熟度レベルとFSharpxのIterateeFP習熟度レベルとFSharpxのIteratee
FP習熟度レベルとFSharpxのIterateepocketberserker
 
10分で分かるr言語入門ver2.10 14 1101
10分で分かるr言語入門ver2.10 14 110110分で分かるr言語入門ver2.10 14 1101
10分で分かるr言語入門ver2.10 14 1101Nobuaki Oshiro
 
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」Shin Ise
 
シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)icchy
 
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~Fujio Kojima
 
「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of Python「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of PythonTakanori Suzuki
 
10分で分かるr言語入門ver2.9 14 0920
10分で分かるr言語入門ver2.9 14 0920 10分で分かるr言語入門ver2.9 14 0920
10分で分かるr言語入門ver2.9 14 0920 Nobuaki Oshiro
 
Vim の話
Vim の話Vim の話
Vim の話cohama
 

Semelhante a Hello World Python featuring GAE (20)

Python Kyoto study
Python Kyoto studyPython Kyoto study
Python Kyoto study
 
JavaScript 講習会 #1
JavaScript 講習会 #1JavaScript 講習会 #1
JavaScript 講習会 #1
 
Introduction of Python
Introduction of PythonIntroduction of Python
Introduction of Python
 
PEP8を読んでみよう
PEP8を読んでみようPEP8を読んでみよう
PEP8を読んでみよう
 
2017/12/21 虎の穴 Python勉強会
2017/12/21 虎の穴 Python勉強会2017/12/21 虎の穴 Python勉強会
2017/12/21 虎の穴 Python勉強会
 
Pythonで始めるDropboxAPI
Pythonで始めるDropboxAPIPythonで始めるDropboxAPI
Pythonで始めるDropboxAPI
 
DATUM STUDIO PyCon2016 Turorial
DATUM STUDIO PyCon2016 TurorialDATUM STUDIO PyCon2016 Turorial
DATUM STUDIO PyCon2016 Turorial
 
「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12
「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12
「Python言語」はじめの一歩 / First step of Python / 2016 Jan 12
 
HiRoshimaR3_IntroR
HiRoshimaR3_IntroRHiRoshimaR3_IntroR
HiRoshimaR3_IntroR
 
FP習熟度レベルとFSharpxのIteratee
FP習熟度レベルとFSharpxのIterateeFP習熟度レベルとFSharpxのIteratee
FP習熟度レベルとFSharpxのIteratee
 
10分で分かるr言語入門ver2.10 14 1101
10分で分かるr言語入門ver2.10 14 110110分で分かるr言語入門ver2.10 14 1101
10分で分かるr言語入門ver2.10 14 1101
 
第1回python勉強会
第1回python勉強会第1回python勉強会
第1回python勉強会
 
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
すごいHaskell読書会 in 大阪 #4 「第6章 モジュール」
 
Django_fukuoka
Django_fukuokaDjango_fukuoka
Django_fukuoka
 
Django_Fukuoka
Django_FukuokaDjango_Fukuoka
Django_Fukuoka
 
シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)シェル芸初心者によるシェル芸入門 (修正版)
シェル芸初心者によるシェル芸入門 (修正版)
 
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
C# 式木 (Expression Tree) ~ LINQをより深く理解するために ~
 
「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of Python「Python言語」はじめの一歩 / First step of Python
「Python言語」はじめの一歩 / First step of Python
 
10分で分かるr言語入門ver2.9 14 0920
10分で分かるr言語入門ver2.9 14 0920 10分で分かるr言語入門ver2.9 14 0920
10分で分かるr言語入門ver2.9 14 0920
 
Vim の話
Vim の話Vim の話
Vim の話
 

Último

Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directoryosamut
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000Shota Ito
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxAtomu Hidaka
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
UPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdfUPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdffurutsuka
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 

Último (9)

Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
UPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdfUPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdf
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
 

Hello World Python featuring GAE

  • 1. Hello World Python featuring GAE maito kuwahara
  • 2. a table of contents • 自己紹介 • タプル • なぜPython? • ディクショナリ • なぜGAE? • if文 • Pythonの起動方法 • forループ • Pythonの終了方法 • 関数 • HelloWorld • import • 変数 • class • 文字列 • hello world using GAE • 数値 • リスト
  • 3. 自己紹介 • maito kuwahara • twitter @maito • facebook https://www.facebook.com/maitokuwahara • Blog http://temping-amagramer.blogspot.jp/ • 2006年∼2010年 日本ソフトウエア株式会社 SE(ColdFusion Oracle HTML JS CSS) • 2010年∼ NHNJapan RIA(JavaScript PHP) • 私生活では、、、 Python Objective-C PHP scheme Cなどなど。 • 本格的なプログラミングは、就職後。
  • 4. なぜPython • ずばり、GoogleAppEngineの魅力
  • 5. なぜGoogleAppEngine • Googleのアカウントを持っていたので、複雑な登録作業不要 • RDBMSではないが、DBが使用可 • 他のレンタルサーバーと違い、無料
  • 6. Pythonの起動方法 • for mac テキスト • ターミナルを起動 • pythonと入力し、Enter • for windows • コマンドプロンプトを起動 • cdコマンドでpython.exeファイルが あるところまでディレクトリを移動 • pythonと入力し、Enter
  • 7. Pythonの終了方法 • exit()を入力 テキスト • enter テキスト
  • 8. Hello World • print “hello world”と入力してEnter >>> print "hello world" hello world • print “hello yoyogi.py”と入力してEnter >>> print "hello yoyogi.py" hello yoyogi.py • print 3.14と入力してEnter >>> print 3.14 3.14
  • 9. 変数 • 文字列、数値、リストなどの値を格納する容器 ex) >>> hoge = 'today is 3rd yoyogi.py' >>> print hoge today is 3rd yoyogi.py • 変数名は、英数字かつ、先頭文字は、英単語 • 一部の名前については、使用不可 ex) if、for、class、tryなどなど
  • 10. 文字列 • 英単語、日本語、数字、記号などの文字の組み合わせ • 変数に設定するときは、「‘」または「“」で囲む必要が有り • 文字列同士を繋げたい場合は、「+」で接続 ex1) >>> foo = 'greed' >>> print foo greed ex2) >>> foo = "greed " + " is " + " good " >>> print foo greed is good ex3) >>> foo = "I " >>> bar = " study " >>> hoge = " python" >>> result = foo + bar + hoge >>> print result I study python
  • 11. 数値 • 数字とカンマ「.」で構成 • 四則演算可能 • 文字列と連結は、NG ex) NG Pattern >>> love = "akihabara" + 48 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot concatenate 'str' and 'int' objects OK Pattern >>> love = "akihabara " + str(48) >>> print love akihabara 48
  • 12. リスト • 文字、数値などで構成される集合体 • indexの指定により、リストの各要素を取得可能 • indexの先頭は、0 • 要素毎の更新可能 ex) hoge = ["today","is",5,22] >>> print hoge ['today', 'is', 5, 22] >>> print hoge[1] is >>> hoge[2] = 6 >>> print hoge ['today', 'is', 6, 22]
  • 13. タプル • 文字、数値などで構成される集合体 • indexの指定により、リストの各要素を取得可能 • indexの先頭は、0 • 要素毎の更新不可 ex) hoge = ("today","is",5,22) >>> print hoge ('today', 'is', 5, 22) >>> print hoge[1] is >>> hoge[2] = 6 >>> print hoge Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'tuple' object does not support item assignment
  • 14. ディクショナリ • key(キー)とvalue(文字、数値などで)構成される集合体 • keyの指定により、ディクショナリの各要素を取得可能 • 要素毎の更新可能 ex) hoge = {'x':3,'y':"foo",'z':8} >>> print hoge['x'] 3 >>> hoge['y'] = 'bar' >>> print hoge['y'] bar
  • 15. if文 • ある条件をクリアーした場合に、特定の処理を実行 ex) >>> hoge = [3,"foo",8] >>> #最後に「:」が必要 >>> if hoge[0] > 3: ... #インデントを必ず行う ... print "check it" ... #3以下の場合に実行される ... else: ... print "come on" ... come on
  • 16. for文 • 繰り返し処理を行いたい場合に使用 ex1) >>> hoge = [3,"foo",8] >>> #最後に「:」が必要 >>> for i in hoge: ... print i ... 3 foo 8 ex2) >>> #rangeは関数 >>> for i in range(3): ... print i ... 0 1 2
  • 17. 関数 • ある特定の処理を実行してもらう機能 ex1) >>> def foo(args): ... print args ... >>> foo('call me') call me ex2) >>> def foo(args): ... return "take" + args ... >>> ret = foo(' my breath away') >>> print ret take my breath away
  • 18. import • ある特定のプログラムの集まりを使用可能な状態に変更 ex1) >>> #乱数を出力するrandomパッケージをimport >>> import random >>> print random.random() 0.537642900846 ex2) >>> #数字関連を扱うmathパッケージをimport >>> import math >>> math.ceil(1.45) 2.0 >>> #日付関連を扱うdatetimeパッケージをimport >>> import datetime >>> d = datetime.datetime.today() >>> print d 2012-05-21 19:27:54.178793
  • 19. class • ある特定のプログラムの集合体 ex1) >>> class hoge(): ... def sayHallo(self,args): ... print "hello " + args ... >>> foo = hoge() >>> foo.sayHallo('yoyogi') hello yoyogi ex2) >>> class hoge(): ... def sayHallo(self): ... print "hello " + self.name ... def setName(self,args): ... self.name = args ... >>> foo = hoge() >>> foo.setName('tokyo') >>> foo.sayHallo() hello tokyo
  • 20. hello world using GAE • demo

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n