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

Want requests.get to wait for redirection during some time
How to run a program by being activated in another program in python
Django: what is the purpose of “$” symbol in urlpatterns?
Installed the google-cloud-storage module 0.22.0, Imports fine by itself but not as an import of an import
replace double quotes with '\"' in python
How to replace sublists within a list?
How to listen for an AUDIO file using Python and Selenium Webdriver
Storing Encrypted Data On A MySQL Database with Python, Pandas and SQLAlchemy [Connection Lost]
How to make python decorators work like a tag to make function calls “by tag”
Pandas - Remove index column
Setting SublimeRepl to work inside venv (sublime 3)
python-docx get info from dropdownlist (in table)
Creating audio file with gTTS for Google Speech API [duplicate]
Python: Make raw input remember commands [duplicate]
Can Omnicomplete in Vim for python/3 complete function names or just methods?
Slowness on iterating over namedtuple and dicts for defined pairs

Categories

HOME
jdbc
crystal-reports
sidekiq
crate
jsviews
blockchain
couchdb-2.0
requirejs
goutte
slim-3
jboss7.x
camera-calibration
store
maxima
ida
python-unicode
arm-template
boolean-expression
sonarqube-msbuild-runner
epicor
apple-tv
facebook4j
header-files
myob
solidworks
superscript
outsystems
transient
large-data
cross-entropy
intellilock
mediawiki-extensions
microdata
resuming-training
z3py
vcf
ajp
w3-total-cache
walmart-electrode
dimple.js
chunked-encoding
maintenance
slot
mcrypt
info
pycurl
date-range
polar-coordinates
cjson
hspec
scalar
windows-nt
spring-repositories
mongo-c-driver
dac
concur
sun-codemodel
difference
anythingslider
throughput
fabric-twitter
textkit
programming-paradigms
integral
criteria-api
coypu
hg-git
proximity
gmaps4rails
line-numbers
dmp
vcl
em
eclipse-classpath
visual-c++-2010-express
leptonica
carddav
client-side-scripting
iconv
qt4.6
code-conversion
responsetext
supersized
galaxy-tab
charts4j
associative
for-xml-path
server-error
search-path
ruby-debug
out-of-browser
osx-leopard
asp.net-mvc-controller
longjmp
outlook-form
divx
dotproject

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