Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python spyder Writing an array to a text file. Create a 2D array as in the previous parts, and write it out to a

image text in transcribed use python spyder

Writing an array to a text file. Create a 2D array as in the previous parts, and write it out to a text file. To do this, do import numpy as np # as usual (CREATE ARRAY arr) np.savetxt('foo.txt',arr) use the .txt extension so other applications will know this is a text file. Then use a text editor (Windows Notepad, or macOS TextEdit) to look at the file. You should see that np. savetxt ) writes the num- bers as floats, not ints, unless you tell it otherwise. In Windows, the line breaks may not show up in Notepad. You can fix this by adding the following optional argument: np.savetxt(... .newline-'rln') which tells np.savetxt(..) to use the standard Windows line break return+newline. Writing an array to a text file. Create a 2D array as in the previous parts, and write it out to a text file. To do this, do import numpy as np # as usual (CREATE ARRAY arr) np.savetxt('foo.txt',arr) use the .txt extension so other applications will know this is a text file. Then use a text editor (Windows Notepad, or macOS TextEdit) to look at the file. You should see that np. savetxt ) writes the num- bers as floats, not ints, unless you tell it otherwise. In Windows, the line breaks may not show up in Notepad. You can fix this by adding the following optional argument: np.savetxt(... .newline-'rln') which tells np.savetxt(..) to use the standard Windows line break return+newline

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions