Python to Replace Skechup Material to Cycles Material I'm using the Blender to make all my works university (architecture), but in my job the people use Sketchup for modeling and V-Ray for rendering. 
I want use Blender, cause liked more then others, the problem is that to rendering with Cycles, I have to need import the Skp file, change all materials (or set), create lamps etc... How to make a Python script that replace the materials by one list in all objects on the scene?

For example:


Cube.001 have the material "OldMaterial.01" in one face, and "OldMaterial.02" in others. 
Cube.002 have the material "OldMaterial.02" in one face, and "OldMaterial.03" in others.


And we have the list:


For "OldMaterial.01", replace to "NewMaterial.01"
For "OldMaterial.02", replace to "NewMaterial.02"
For "OldMaterial.03", replace to "NewMaterial.03"


And the script replace all materials for the match in the list.

That will be increase so much the workflow Sketchup - Blender!

Thanks for now!
Every object has a list of materials it uses in it's material_slots property, this is shown in the material properties, each slot contains the material used. By looping through this list you can change the material assigned to each slot.

I would setup a dictionary of old-to-new names to use for the conversion process.

import bpy

matnames = {
    'OldMaterial.01': 'NewMaterial.01',
    'OldMaterial.02': 'NewMaterial.02',
    'OldMaterial.03': 'NewMaterial.03',
    'OldMaterial.04': 'NewMaterial.04',
    'OldMaterial.05': 'NewMaterial.05',
    'OldMaterial.06': 'NewMaterial.06',
}

for obj in bpy.data.objects:
    for slot in obj.material_slots:
        slot.material = bpy.data.materials[matnames[slot.material.name]]