This week's book giveaway is in the Open Source forum.
We're giving away four copies of Programmers Guide to Apache Thrift and have Randy Abernethy on-line!
See this thread for details.
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How can I print this array out in python?  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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: 11
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
something like this?



where array contains your 7 items (numbers)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!