savetext(filename=None, string=None, **kwargs)[source]#

Convenience function for saving a text file – accepts a string or list of strings; can also save an arbitrary object, in which case it will first convert to a string.

  • filename (str) – the filename to save to

  • string (str) – the string (or object) to save

  • kwargs (dict) – passed to np.savetxt() if saving an array


text = ['Here', 'is', 'a', 'poem']
sc.savetext('my-poem.txt', text)

New in version 3.1.0: fixed bug with saving a list of strings