Retrieving vertex groups

Hello, I was wondering how could I get an object’s vertex group, and change its name via Python. The tool tip suggests I use .name, but I can’t figure out how to get a vertex group in the first place, went though all the bpy functions and found everything but one that apparently lets me get the vertex groups as a list or something.
Also I can’t seem to use print(“stuff”) from the text editor? When I run my python script, the function outputs nothing no where, I don’t know what I’m doing wrong, and I could really use it to help untangle these problems xD
Anyhow thanks!


bpy.context.object.vertex_groups[0].name = "New Name"

are you running blender from a terminal?
http://www.blender.org/documentation/blender_python_api_2_64_9/info_tips_and_tricks.html#use-the-terminal

So it was an array by itsself! I tried the Vertex_groups function, but attempted to assign it to a new array and probably totally screwed it. Yeah, thanks, the terminal works too, thx for that. These are depths of Blender yet unknown to me.

Hai, it’s me again, sorry for asking again, but how would I go about in getting an object’s mesh name and changing that too…Trying object.data.meshes tells me it has no meshes apparently xP

maybe this helps:

ob = bpy.context.object
ob.name = "New name for the mesh object"

me = ob.data
me.name = "New name for the mesh"

I see…tottaly different than vertex groups, oh well I will get the hang of this, thanks!
Could any one link me to a tutorial on data structures or similar, I just can’t seem to get the correct path to all the different types of data and values an object has…

Ah, I see, thanks for the post, that really helps clear things out! Will check those spinets out as well!