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.
512KB ブロックを使用してディスクから情報を抽出するプログラムを作成する必要があります。ディスク イメージ ファイルは raw 形式です。
サイズ引数が 512 * 2^10 (または 512000、サイズがKB か KiB'rb'かに応じて) のサイズ引数を使用して、バイトと内容を読み取るフラグを指定してファイルを開きます。read
'rb'
read
with open('filename', 'rb') as f: block = f.read(512 * 2**10) while block != "": # Do stuff with a block block = f.read(512 * 2**10)