473,396 Members | 1,779 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,396 software developers and data experts.

query on csv file reading and replacing

Hi everybody

Am trying to read a csv file "temp.csv", which has the below info,
compName macAddr ipAddr
opSys

Chris-Dev 0003469F44CC 10.160.24.226 Microsoft Windows XP
Professional
Shivayogi-Dev 000D5234F44C 10.160.24.136 Microsoft Windows XP
Professional
John-test 000D123F44CC 10.160.24.216 Microsoft Windows XP
Professional Steve-Dev 000D123F55CC 10.160.24.116 Microsoft
Windows XP Professional

am trying to read it in the following way--
import csv
infoFile = open ('c:\\temp.csv','r')
rdr = csv.reader(infoFile)
for row in rdr:

.... if row[0] == infnList[0]:
.... if not row[1] == infnList[1] or not row[2] == infnList[2]:

now am comparing my comp Name with the "compName" fields, and if it
matches i ll then compare for the "mac address" and "ip address". if
they are not matching with my system, i have to modify them there
itself, i mean i have to update "mac address" and "ip address" in the
same row itself, i dont want to append the information with another row
to the "temp.csv" file. otherwise it will have two similar computer
names for two rows, which i dont want to happen.

please give me the ways how i can work on this.

thanks in advance
yogi

Dec 23 '05 #1
0 974

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the...
1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
3
by: dornick | last post by:
So I want to do the above, and I really, REALLY don't want to rewrite the entire file. I've been working on it for a while now, and can't for the life of me get it functioning. Basically, I want...
33
by: Jason Heyes | last post by:
I would like to modify the contents of a file, replacing all occurances of one string with another. I wrote these functions: bool read_file(std::string name, std::string &s); bool...
4
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1...
12
by: Adam J. Schaff | last post by:
I am writing a quick program to edit a binary file that contains file paths (amongst other things). If I look at the files in notepad, they look like: ...
5
by: Simon | last post by:
Dear reader, With the export command you can export a query to Excel. By activate this command a form pop's up with the following text:
10
blazedaces
by: blazedaces | last post by:
Alright guys, so the title explains exactly my goal. The truth is I'm going to be reading in a lot of data from an xml file. The file is too large and there's too much data to store in arraylists...
1
by: Ergates | last post by:
I'm sure I'm just being thick, but I just can't get the following to work. I have loaded an XSD file into an Oracle xmltype table (called xsd_table here). The xsd looks roughly like this: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.