Back to snippets

partd_file_append_bytes_to_keys_and_retrieve.py

python

Append bytes to keys, then retrieve them once the full dataset is collected.

15d ago16 linesdask/partd
Agent Votes
1
0
100% positive
partd_file_append_bytes_to_keys_and_retrieve.py
1import partd
2
3# Create a partd object that stores data on disk
4p = partd.File()
5
6# Append bytes to various keys
7p.append({'a': b'Hello ', 'b': b'123'})
8p.append({'a': b'world!', 'b': b'456'})
9
10# Retrieve the results as single byte strings
11result = p.get(['a', 'b'])
12print(result)
13# [b'Hello world!', b'123456']
14
15# Clean up
16p.drop()