boson
boson

Reputation: 894

Bizarre python syntax error with loadtxt

I'm having a problem with loading a data file in python. The error that I'm getting is

datasim = loadtxt("/home/ddrek/Dust/ppc/1925.txt")
        ^
SyntaxError: invalid syntax

Here is the code:

from numpy import *
import matplotlib.pyplot as plt
import pylab

data = loadtxt("/home/di/DI/ic/da/flash/oux.19_"+str(DOM))
d, t, q = data[:,1], data[:,2], data[:,3]                         
d, t, q = loadtxt("/home/di/DI/ic/da/flash/oux.19_"+str(DOM), usecols = #(1,2,3),      unpack=True)

datasim = loadtxt("/home/ddrek/Dust/ppc/1925.txt")

Thanks!

Upvotes: 1

Views: 753

Answers (1)

Christian Tapia
Christian Tapia

Reputation: 34146

Remove the # character from:

d, t, q = loadtxt("/home/di/DI/ic/da/flash/oux.19_"+str(DOM), usecols = #(1,2,3),      unpack=True)

because # is used to make comments in Python.

You may also want to edit your code if it is required.

Upvotes: 3

Related Questions