loadtxt is not working for pendulum.txt
Title
Question
I kept all files in default location as well as D:\\python FDP\\pendulum_semicolon.txt'
In [48]: cat pendulum_semicolon.txt
File "<ipython-input-48-e05dcfac3bb1>", line 1
cat pendulum_semicolon.txt
^
SyntaxError: invalid syntax
In [49]: pendsemi=loadtxt("pendulum_semicolon.txt")
---------------------------------------------------------------------------
ValueError: could not convert string to float: '1.0000e-01;6.9004e-01'
In [52]: open("D:\python FDP\pendulum_semicolon.txt")
Out[52]: <_io.TextIOWrapper name='D:\python FDP\pendulum_semicolon.txt' mode='r' encoding='cp1252'>
any problem with windows version?
Python-3.4.3 Loading-Data-From-Files 08-09 min 10-20 sec
Answers:
cat is a linux specific command. In windows, type !type pendulum_semicolon.txt inside ipython terminal
Try to add a delimiter in the loadtxt command. The command should be
pendsemi=loadtxt("pendulum_semicolon.txt", delimiter=";")
Login to add comment