Ad
2: 2017-01-02 (月) 07:20:11 njf ソース バックアップ No.2 を復元して編集 現: 2017-05-25 (木) 02:59:32 njf ソース 編集
Line 5: Line 5:
 def testFunc():  def testFunc():
     print "test"      print "test"
 + 
 testFunc()  testFunc()
Line 16: Line 16:
 def testFunc(a,b,c):  def testFunc(a,b,c):
     print "a:%s,b:%s,c:%s" % (a,b,c)      print "a:%s,b:%s,c:%s" % (a,b,c)
 + 
 testFunc("a","b","c")  testFunc("a","b","c")
Line 45: Line 45:
 def testFunc(a, b = "b", c = "c"):  def testFunc(a, b = "b", c = "c"):
     print "a:%s,b:%s,c:%s" % (a,b,c)      print "a:%s,b:%s,c:%s" % (a,b,c)
 + 
 testFunc("a","b")  testFunc("a","b")
Line 66: Line 66:
     for i in i_list:      for i in i_list:
         print i          print i
 + 
 testFunc(1,2)  testFunc(1,2)
Line 86: Line 86:
     for k,v in i_dic.iteritems():      for k,v in i_dic.iteritems():
         print k,v          print k,v
 + 
 testFunc(A='a',B='b')  testFunc(A='a',B='b')
Line 107: Line 107:
 def testFunc(a, b, c):  def testFunc(a, b, c):
     print "a:%s,b:%s,c:%s" % (a,b,c)      print "a:%s,b:%s,c:%s" % (a,b,c)
 + 
 f = testFunc  f = testFunc
 + 
 f("a","b","c")  f("a","b","c")
Line 115: Line 115:
 a:a,b:b,c:c  a:a,b:b,c:c
-ただし、定義と共に変数や関数の引数には入れられないため、その場合はラムダ式を使います。ラムダ式については「[[Python/ラムダ式]]」を参照のこと。+ただし、定義と同時に変数や関数の引数には入れられないため、その場合はラムダ式を使います。ラムダ式については「[[Python/ラムダ式]]」を参照のこと。
**再帰関数 [#ed12d72f] **再帰関数 [#ed12d72f]
Line 123: Line 123:
         print n          print n
         printN(n-1)          printN(n-1)
 + 
 printN(3)  printN(3)
Line 137: Line 137:
     """print a,b,c"""      """print a,b,c"""
     print "a:%s,b:%s,c:%s" % (a,b,c)      print "a:%s,b:%s,c:%s" % (a,b,c)
- +  
 + 
 print testFunc.__doc__  print testFunc.__doc__


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
Counter: 1995, today: 2, yesterday: 2
MenuBar
広告

ログイン

ユーザー名:


パスワード:





パスワード紛失

Portuguese | English | German | Greek | Japanese | Korean | Russian | T-Chinese top
NJF