Loadtxt Examples

From Python Wiki

Jump to: navigation, search

Read a 2 column file

This example keeps prompting the user to enter a filename until it finds the file. It then reads the first column of the file into an array called time, and the second column into an array called response

 while not found_file:
     FILE=raw_input('Enter Time History File > ')
 time, response = np.loadtxt(FILE,unpack=True)
Personal tools