loading file
Title
Question
I am using python 3.7 version in windows 10.
the 'cat' function is not available and the file is not opening.
please, provide the required solution.
I have tried the other way by load function also but it is not opening.
Python-3.4.3 Loading-Data-From-Files 01-02 min 0-10 sec
Answers:
Steps to open or load the files:-
1. Download the resources file available in the tutorial. Extract it in case of a zip file.
2. Check the current working directory of ipython by typing %pwd command inside theipython terminal.
3. Copy all the files into the current working directory as shown by the %pwd command.
4. To check the contents of the file type !type <filename>in the ipython terminal.
5. To load the file using loadtxt command type loadtxt("<filename>") in the ipython terminal.
!type <filename> it worked
loadtxt("<filename>") this is not working
my command is
pendsemi=loadtxt("pendulum_semicolon.txt")
In case of this file, it contains semicolon with the numbers.
So you will get error as loadtxt by default converts the content to float.
Solution as in the tutorial, provide delimiter.
You can also explore the loadtxt function definition to understand have to change the default data type.
Login to add comment
Login to add comment