I have to replace the north, south, etc with N S in address fields.
If I have
list = {\'NORTH\':\'N\',\'SOUTH\':\'S\',\'EAST\':\'E\',\'WEST\':\'W\'}
you are close, actually:
dictionary = {"NORTH":"N", "SOUTH":"S" }
for key in dictionary.iterkeys():
address.upper().replace(key, dictionary[key])
Note: for Python 3 users, you should use .keys() instead of .iterkeys():
dictionary = {"NORTH":"N", "SOUTH":"S" }
for key in dictionary.keys():
address.upper().replace(key, dictionary[key])