Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
msto authored Sep 11, 2024
1 parent d91c3a7 commit 377bcc7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ with open("test.tsv", "w") as testfile:
testfile.write("1\tabc\n")
testfile.write("2\tdef\n")

with DataclassReader.open("test.tsv", MyData) as reader:
with open("test.tsv", "r") as fin:
reader = DataclassReader(fin, MyData)
for record in reader:
print(record.foo)
```
Expand All @@ -54,7 +55,8 @@ class MyData:
bar: str


with DataclassWriter.open("test.tsv", MyData) as writer:
with open("test.tsv", "w") as fout:
writer = DataclassWriter(fout, MyData)
for i in range(3):
record = MyData(foo=i, bar="something")
writer.write(record)
Expand Down

0 comments on commit 377bcc7

Please sign in to comment.