文字列の分割
>>> str = "abcde" >>> for x in str: ... print x + ' ', ... a b c d e >>> str[0] 'a' >>> str[1:3] 'bc' >>> str[3:] 'de' >>> str[:2] 'ab' >>> str[:] 'abcde' >>> str[::1] 'abcde' >>> str[::2] 'ace' >>> str[::3] 'ad' >>> str[::4] 'ae' >>> str[::] 'abcde' >>> str = "あいうえお" >>> str '\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8' >>> for x in str: ... print x + ' ', ... (無惨) >>> str = unicode("あいうえお",sys.getfilesystemencoding()) >>> str u'\u3042\u3044\u3046\u3048\u304a' >>> for x in str: ... print x + ' ', ... あ い う え お >>>
この辺がCっぽい。