[Numpy-discussion] reshape

Nadav Horesh nadavh@visionsense....
Fri Nov 7 06:46:09 CST 2008

I can not figure out the format specifications, but the following function might be a good starting point:

def lst_to_file(lst, filename, fmt='%08d'):
        lst: list of arrays to write
        filename: output file name
        fmt: The format of  single item
	str_lst = []
	for l in lst:
		format = len(l)*fmt + '\n'
		str_lst.append(format % tuple(l))
	open(filename, 'w').write(''.join(str_lst))

-----הודעה מקורית-----
מאת: numpy-discussion-bounces@scipy.org בשם Nils Wagner
נשלח: ה 06-נובמבר-08 22:07
אל: Discussion of Numerical Python
נושא: Re: [Numpy-discussion] reshape
On Thu, 6 Nov 2008 21:50:52 +0200
  "Nadav Horesh" <nadavh@visionsense.com> wrote:
> A correction:
> lines_list = [cc[i:i+8] for i in range(1, len(cc),  8)]
> Nadav

Hi Nadav,

Thank you very much. My next question;

How can I save lines_list to a file with the following
so called small field format (NASTRAN). Each row consists
of ten fields of eight characters each.
Field 1 should be empty in my application.
Field 10 is used only for optional continuation 
information when applicable.


Numpy-discussion mailing list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3607 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081107/241aa688/attachment.bin 

More information about the Numpy-discussion mailing list