I'm working on a linear regression program and when I try to convert the input file data to a float (it reads in as a string), I get this error. Perhaps someone can help me? I'm using Windows XP, and IDLE. (also the console screen).
Code:
#! /usr/bin/env python
import sys
import os
from numpy import *
numLst = [] #an empty list
if len(sys.argv) == 2:
infile = open(sys.argv[1], 'r')
elif len(sys.argv)
>>v = raw_input("Ente r: ")
Enter: kjjkj
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'kjjkj'
In my program I need to be able to enter char strings or int strings on
the command line. Then I use an if-elif structure to establish which is
which. For example -