Commits

Takayuki KONDO  committed 2ca2244

#08 文字列を扱ってみよう(3)

  • Participants
  • Parent commits 3c1ba06

Comments (0)

Files changed (1)

 # -*- coding:utf-8 -*-
 # 文字列の操作
 
-# 連結 + 
-print "hello" + "world" 
+s = "abcdefghi"
 
+# 切り出し []  [start:end]
 
-# 繰り返し *
-print u"無駄!" * 10
+print s[1]
 
-# 長さ len
-print len("abcdefg")
+print s[1:5]
+print s[:5]
+print s[1:]
 
+print s[1:-1]
+
+# 検索
+
+print s.find("cd")
+print s.find("cx") # -1 
+
+
+
+