Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write html to arbitrary stream, not filename #89

Open
NoahAmsel opened this issue Apr 27, 2021 · 0 comments
Open

Write html to arbitrary stream, not filename #89

NoahAmsel opened this issue Apr 27, 2021 · 0 comments

Comments

@NoahAmsel
Copy link

Currently, the write_html method accepts the name of a file and writes the HTML representation there. I'd like to be able to write to other kinds of streams besides files, for example:

from pyvis.network import Network
import sys
nt = Network("500px", "800px")
nt.write_html(sys.stdout)

Perhaps write_html can accept a file object instead of a string. For convenience, the show method could still take a string as before. Alternatively, write_html can check the type of its argument. If it's a string, the function behaves as it does now. If its a file object, the function writes to it.

Thanks for the great package!

norweeg added a commit to norweeg/pyvis that referenced this issue Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant