Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
64018e6f
Commit
64018e6f
authored
Jan 18, 2009
by
Tiago Peixoto
Browse files
Expand user dir (~) in file IO
e.g., g.save("~/foo.xml")
parent
8ae75c9f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/graph_tool/core.py
View file @
64018e6f
...
...
@@ -549,6 +549,7 @@ class Graph(object):
"""Load graph from 'filename' (which can also be a file-like
object). The format is guessed from the file name, or can be specified
by 'format', which can be either 'xml' or 'dot'."""
filename
=
os
.
path
.
expanduser
(
filename
)
if
format
==
'auto'
and
isinstance
(
filename
,
str
):
if
filename
.
endswith
(
".xml"
)
or
filename
.
endswith
(
".xml.gz"
)
or
\
filename
.
endswith
(
".xml.bz2"
):
...
...
@@ -577,6 +578,7 @@ class Graph(object):
def
save
(
self
,
filename
,
format
=
"auto"
):
"""Save graph to file. The format is guessed from the 'file' name, or
can be specified by 'format', which can be either 'xml' or 'dot'."""
filename
=
os
.
path
.
expanduser
(
filename
)
if
format
==
'auto'
and
isinstance
(
filename
,
str
):
if
filename
.
endswith
(
".xml"
)
or
filename
.
endswith
(
".xml.gz"
)
or
\
filename
.
endswith
(
".xml.bz2"
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment