Python Forum
select Data input from csv file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
select Data input from csv file
#1
I need to get data from a csv (text) file.
I only need to read one piece of data from the csv file.

I am using Python in Blender 2.79 to control the movement of a model using data from the csv file.

CSV FILE:
Line5=58,5,0.5,77.5,1,,,,,,10
Line6=51,5,12,85,1,0,0,,0,1.5,10
Line7=89,0,0,,,,,,,,10
Line8=13,5,29.0,,,,,,,,10

Example - I need to read the second number on the top line (5).
Then convert it to a number so I can use it to move my model by that amount.

See below, this is what I have tried so far but it reads the second number from all the lines and I can not use it to create a single variable.
import csv
data = open(path+"TL3.txt", "r")
reader = csv.reader(data, delimiter=',')
next(reader)
row = data.readlines()
for row in reader:
print(row[1])
data.close()
Quote:

Any help is greatly received. (I would not like to say how long I have been searching for an answer to this)

Sean
Reply


Messages In This Thread
select Data input from csv file - by SeanBassett - Jan-21-2018, 08:48 PM
RE: Seleted data from a csv file - by j.crater - Jan-21-2018, 09:33 PM
RE: select Data input from csv file - by j.crater - Jan-21-2018, 10:03 PM
RE: select Data input from csv file - by j.crater - Jan-21-2018, 08:50 PM
Seleted data from a csv file - by SeanBassett - Jan-21-2018, 09:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 438 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  manually input data jpatierno 0 358 Nov-10-2023, 02:32 AM
Last Post: jpatierno
  Input network device connection info from data file edroche3rd 6 1,091 Oct-12-2023, 02:18 AM
Last Post: edroche3rd
Question in this code, I input Key_word, it can not find although all data was exact Help me! duchien04x4 3 1,084 Aug-31-2023, 05:36 PM
Last Post: deanhystad
  select files such as text file RolanRoll 2 1,191 Jun-25-2022, 08:07 PM
Last Post: RolanRoll
  Showing an empty chart, then input data via function kgall89 0 991 Jun-02-2022, 01:53 AM
Last Post: kgall89
Question Change elements of array based on position of input data Cola_Reb 6 2,172 May-13-2022, 12:57 PM
Last Post: Cola_Reb
  Reading an Input File DaveG 1 1,269 Mar-27-2022, 02:08 AM
Last Post: deanhystad
  input data validation plumberpy 2 1,808 Aug-11-2021, 12:04 PM
Last Post: plumberpy
  Select data between DW felmback 2 2,028 Mar-21-2021, 01:49 PM
Last Post: ibreeden

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020