Python 3.1.2 (r312:79147、2010 年 11 月 9 日、09:41:54) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] linux2 上 詳細については、「ヘルプ」、「著作権」、「クレジット」、または「ライセンス」と入力してください。 >>> open("/home/madsc13ntist/test_file.txt", "r").readlines()[6] トレースバック (最新の呼び出しが最後): ファイル ""、1 行目、 ファイル「/usr/local/lib/python3.1/codecs.py」、300行目、デコード中 (結果、消費) = self._buffer_decode(データ、self.errors、最終) UnicodeDecodeError: 'utf8' コーデックは位置 2230 のバイト 0xae をデコードできません: 予期しないコード バイト
それでも...
Python 2.4.3 (#1、2010 年 9 月 8 日、11:37:47) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] linux2 上 詳細については、「ヘルプ」、「著作権」、「クレジット」、または「ライセンス」と入力してください。 >>> open("/home/madsc13ntist/test_file.txt", "r").readlines()[6] '2010-06-14 21:14:43 613 xxx.xxx.xxx.xxx 200 TCP_NC_MISS 4198 635 GET http www.thelegendssportscomplex.com 80 /thumbnails/t/sponsors/145x138/007.gif - - - 直接 www.thelegendssportscomplex .com image/gif http://www.thelegendssportscomplex.com/ 「Mozilla/4.0 (互換性あり; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.1; MS-RTC LM 8) " 観察 "スポーツ/レクリエーション" - xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx\r\n'
.readlines()[6] が python-3 では機能しないのに 2.4 では機能する理由を知っている人はいますか?
また... 0xAE は ® だと思っていました