I am new to python but not to programming. I have a very simple problem that I can't seem to workout in python. With other programming languages it is simple but python INSISTS on making it complicated.
The first section of the code defines an empty array (or in python, a list) called timestep. The code then opens a comma delimited text file with input acceleration time histories (first column is time and the following columns are accelerations). The code then appends the values in the first column of the .csv file line-by-line to the list 'timestep'. NOTE: I AM VERY NEW TO PYTHON SO ANY HELP OR ADVISE ON WHAT I CURRENTLY HAVE WOULD BE SUPER, I LOVE TO LEARN .
- Code: Select all
timestep = 
accfile = open('Book1.csv', 'rb')
reader = csv.reader(accfile)
for line in reader:
t = line
Later in the code i need to use elements within the timestep list in a formula (complex fourier transform). In other programming languages this is SIMPLE (for example in VBA....... timestep(n)*1000 would give me the value of the nth timestep element multiplied by 1000. However......python does not seem to think like this.
Consider timestep(n) = 0.005. Instead of giving me the value of timestep(n) multiplied by 1000 which I would expect to give me 5, it gives me 0.0050.005
I suspect this is something to do with python reading the list as a script? I'm really really trying to enjoy python but so far it seems to throw convention out the window and is beginning to grind me down please can someone help and shed light on this.......and please don't mention the word 'tuple'.......seriously.....'TUPLE'....what were they thinking? Haha
Thanks in advance guys