Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
かなり単純な一致のためにUTF16-LEで記述されたファイルを解析していますが、いずれもトリガーされていないようです。たとえば、次のコードがあります。
with open(filepath) as f: for line in f: if 'TEST_CASE' in line: print(line)
ファイル自体を変更せずに、ファイル内の行が一致するかどうかを確認する良い方法はありますか?
私のコメントによるとcodecs.open('filename', encoding='utf-16-le')
codecs.open('filename', encoding='utf-16-le')