python的字串切割
該怎麼說起呢?
例如:
world="abcde" 這個字串
看得懂吧?
先說喔 world中的第一個字
它的index是0喔
例如: world[0]
>>>'a'
我們可以用 world[0:]
她就print 出
>>>'abcde'
懂吧?
看不懂?!
再試幾個例子
world[2:4]
就print 出
>>>'cd'
不過 我覺得比較好玩的是
他的index可以用負數的
如果是負的 就是從字串的最後那個字元開始算起喔
例如:world[-1]
就print出
>>>'e'
我們再玩幾個例子吧
world[0:-1]
>>>'abcd'
world[-2]
>>>'d'
咦?
world[0]
>>>'a'
跟 world[-5]
>>>'a'
是一樣的結果 ~~
這下子你知道了吧^^
2008年8月7日 星期四
訂閱:
張貼留言 (Atom)
Class has no initializers in swift
Class has no initializers in swift I have met this situation. Found a solution here It says if you have the code like bellow var se...
-
= =||| 我覺得 我投影片做的越來越好了 真糟糕.....= =a
-
以下我講的都是在說 還未經過任何中文化的puppy linux喔~ 那麼...要如何解決這個剛從國外網站下載的puppy 看中文網頁(繁體)都會出現亂碼的問題呢? 我搜了一下他們的論壇 整理如下: 如果你現在使用的系統是linux的話 (我以ubuntu為例) 1. 先把 /u...
-
If you integrate MobileVLCKit to your app, and found you have this hints.. Undefined symbols for architecture arm64: "_VTDecompress...
沒有留言:
張貼留言