• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I print this array out in python?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
question concerning how to print 7 items out of an array with python

This is what I want-The first item out of the array of 7 gets its own line

3.2345
1.2134, 2.2134, 3.2134, 5.1134, 7.1134, 3.1134


Iam using this python code

np.savetxt(test.out', np.column_stack([D, X, Y, Z, A, B, C]), fmt=%1.4f', delimeter=', ')

This is what I get in my text file

3.2345 1.2134, 2.2134, 3.2134, 5.1134, 7.1134, 3.1134

Do you know what I need to do to make the first item seperate out from the other 6 items?
Ultimately I want it to look like this in the text file.

3.2345
1.2137, 2.2134, 3.2134, 5.1134, 7.1134, 3.1133
3.2345
1.2134, 2.2134, 2.2134, 5.1134, 7.1134, 3.1134
3.2345
1.2134, 2.2136, 3.2134, 5.0134, 7.1134, 3.1135
3.1345
1.2134, 2.2134, 3.2134, 5.1134, 4.1134, 2.1134
3.2345
1.1134, 1.2134, 3.2134, 5.1134, 7.1134, 3.1134
thank you.
 
Greenhorn
Posts: 12
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
something like this?



where array contains your 7 items (numbers)
 
reply
    Bookmark Topic Watch Topic
  • New Topic