python


Detecting a change in a CSV row


I am trying to find a way to detect when string elements in csv file change values. When the value changes, I want the operation of the program to change. I want to read the value in the for loop one step ahead and compare it to the current value. Unfortunately my research has only turn up results that step the for loop ahead by one rather than simply reading the value.
Any help would be appropriated.
import csv
with open("bleh.csv", "r") as bleh:
blehFileReader = csv.reader(bleh, delimiter=',')
next(blehFileReader, None)
for row in blehFileReader:
name = row
nextname = next(blehFileReader)
print(name)
if name != nextname:
print ("name has changed")
Instead of looking at the next name, look at the previous one:
previous_name = None
for row in blehFileReader:
if row != previous_name:
print ("name has changed")
....
previous_name = row

Related Links

Disable logging during manage.py test?
turbogears request/user object in templates and request context
Django date filter to output “am” or “A.M.”
Schedule Python Script - Windows 7
slicing arrays in numpy/scipy
Recommendations for a simple 2D graphics python library that can output to screen and pdf?
Reading numpy arrays outside of Python
Return value from thread
Is this control structure a code smell?
Django: How do I validate unique_together from within the model
Munging non-printable characters to dots using string.translate()
Error when using astWCS trying to create WCS object
if there any better way to read bb function souce code.i was very faint
PyQt4 signals and slots
Sql Alchemy What is wrong?
How do I plot a graph in Python?

Categories

HOME
sharepoint
caching
jdbc
udp
openssl
tinyos
puzzle
system-verilog
raspbian
jbehave
google-sheets-api
ios10
simpy
httpclient
jframe
constructor
xamarin-studio
dryioc
gwtp
multiple-monitors
mod-pagespeed
riak-ts
google-api-java-client
statusbar
google-maps-android-api-2
url.action
apply
kitematic
csh
non-deterministic
continuous-deployment
spring-data-neo4j
fetch-api
reply
twitter-bootstrap-2
ipfw
division
.net-assembly
ntfs-mft
infusionsoft
ddms
jdbi
php-ews
archer
fqdn
double-buffering
drawingarea
pluck
butterknife
addin-express
lotus
pspice
verbose
typhoon
libreadline
xib
packagemaker
visible
firepath
asteriskami
pagekit
database-backups
spatial-query
yoothemes
fortran90
loopj
multinomial
android-recyclerview
difference
hateoas
hyperthreading
selendroid
es2015
client-side-validation
utf-32
genetic-programming
smartystreets
ssms-addin
ksoap2
roxygen
dynamic-proxy
bsod
visual-studio-addins
nscolor
apache2.2
shortcuts
arbor.js
android-contextmenu
zend-framework-modules
qsqltablemodel
autostart
symfony-2.0
deploying
mpmovieplayer
concurrent-programming
graniteds
database-diagramming

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App