On Thu, Nov 20, 2008 at 10:24 AM, Joshua Lippai <[EMAIL PROTECTED]> wrote:
> Hey,
>
> I'm working on a project for which I would like to dump data into a
> file in a specified directory (that doesn't necessarily exist yet). I
> know matplotlib.mlab.save(fname, X) will only work if I want to save
> data from an array/list to a file in the current working directory. Is
> there an easy way using matplotlib to:
>
> A) Save a file to a specified directory rather than the current
> working directory
Just specify the full path to the output dir:
save('/path/to/my/data.dat')
or use the os modules built-in functions for cross-platform path handling:
save(os.path.join(outdir, filename))
> B) Create a directory I tell it to save to if it doesn;t already exist
You can use os.mkdir. mpl svn has a function cbook.mkdirs to
recursively make a directory path.
JDH
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users