pg.open_jsonl

Accessible via pg.open_jsonl, pg.symbolic.open_jsonl.

open_jsonl(path, mode='r', **kwargs)[source]

Open a JSONL file for reading or writing.

Example:

with pg.open_jsonl('my_file.jsonl', 'w') as f:
  f.add(1)
  f.add('foo')
  f.add(dict(x=1))

with pg.open_jsonl('my_file.jsonl', 'r') as f:
  for value in f:
    print(value)
Return type:

pg.io.Sequence

Parameters:
  • path – The path to the file.

  • mode – The mode of the file.

  • **kwargs – Additional keyword arguments that will be passed to pg_io.open_sequence.

Returns:

A sequence for PyGlove objects.