473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

read specific lines in a .csv file particularly the last line

I'm looking to read the last line in a .csv file for calculation purposes. I need to get two values from the last line of a .csv file so I can use these values to calculate other values in the program. Or if this is to difficult, the whole point of this is to be able to have a “calibration file” which will story the setting for a machine which will be calibrated occasionally and after each calibration the calibration file will be updated and then the most recent values will be read into the program and used for calculation purposes.

Thank You
Nov 17 '06 #1
3 3194
albertw
267 100+
I'm looking to read the last line in a .csv file for calculation purposes. I need to get two values from the last line of a .csv file so I can use these values to calculate other values in the program. Or if this is to difficult, the whole point of this is to be able to have a “calibration file” which will story the setting for a machine which will be calibrated occasionally and after each calibration the calibration file will be updated and then the most recent values will be read into the program and used for calculation purposes.

Thank You
hi

do you need a file for this ?

if you run your program on the same machine you may use
something like
SaveSetting "Program","Properties","Setting1",strSetting1

get the value back by

strSetting1=Getsetting ("Program","Properties","Setting1,"")

otherwise


Open FileName For Input As #1
While Not EOF(1)
Line Input #1, p
LastLine = p
Wend
Close #1


LastLine contains the data from the last line in the file
Nov 17 '06 #2
hi

do you need a file for this ?

if you run your program on the same machine you may use
something like
SaveSetting "Program","Properties","Setting1",strSetting1

get the value back by

strSetting1=Getsetting ("Program","Properties","Setting1,"")

otherwise


Open FileName For Input As #1
While Not EOF(1)
Line Input #1, p
LastLine = p
Wend
Close #1


LastLine contains the data from the last line in the file

Thank you for your response

while waitng i actually realized that the data was in the variable name.
Nov 17 '06 #3
albertw
267 100+
Thank you for your response

while waitng i actually realized that the data was in the variable name.
hi

if you know this name, suppose that's a filename
you can make a commondialog control or a textbox to enter this filename.
Nov 17 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: sea | last post by:
I have text files in the following format: 123,34, ,345,890, 123,23 .. .. .. As you can see, the problem is that (1) the commas can occur in
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
3
by: JenHu | last post by:
Hi, I want read line by line and characters. The characters are fix length text file, no specific delimited method between each fields. The first line is header line, the last line is footer. ...
34
by: Ross Reyes | last post by:
HI - Sorry for maybe a too simple a question but I googled and also checked my reference O'Reilly Learning Python book and I did not find a satisfactory answer. When I use readlines, what...
9
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all...
0
by: Francesco Pietra | last post by:
I forgot to add that the lines to strip are in present case of the type of the following block HETATM 7007 O WAT 446 27.622 34.356 55.205 1.00 0.00 O HETATM 7008 H1 WAT...
11
by: jo3c | last post by:
hi everybody im a newbie in python i need to read line 4 from a header file using linecache will crash my computer due to memory loading, because i am working on 2000 files each is 8mb ...
4
by: Curious | last post by:
I have a file to which I'll need to at first read until it locates the last line of string. According to content of the last line of string, I'll need to write something to this file right after...
4
by: Keith G Hicks | last post by:
I'm trying to read a text file and alter the contents of specific lines in the file. I know how to use streamreader to read each line of a file. I'm doing that already to get the data into a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.