I don't know what is wrong with my python script
For global coordinates, multiply local coordinates by world matrix of object.

Data (obj.data) coordinates are in local space.  The global scene coordinates have an origin at (0, 0, 0) with no rotation or scale. An object's origin is its local coordinate (0, 0, 0).  An object's location is the location of its origin.    

Latitude and longitude on earth could be considered a local coordinate system, with origin (0, 0) ... It's just some arbitrary point on the equator.. It tells us nothing about where we are in the universe, that the axis is tilted towards the sun...

Can calculate a global coordinate from any local coordinate by pre-multiplying the vector by the object's matrix world (obj.matrix_world) This accounts for any translation, rotation and scale on the object in global space.

When an object has no transformation, no rotation and unity scale, its world matrix is the Identity matrix.  Multiplying by the identity matrix is the scalar equivalent of multiplying by one.  In this case, and only this case, all global and local coordinates will be the same.  Will find a number of answers on here that don't take this into account.

Applying location, rotation and scale has the effect of making an objects matrix world identity, by converting all local coordinates to their global equivalent. 

import bpy
obj = bpy.context.object
mw = obj.matrix_world
scene = bpy.context.scene
obj_mesh = obj.to_mesh(scene, True, 'PREVIEW')
local_coords = [v.co for v in obj_mesh.vertices]
print("total numbers of vertices generated = %d" % len(local_coords))
for local_coord in local_coords:
    global_coord = mw * local_coord
    bpy.ops.mesh.primitive_uv_sphere_add(size=0.05,
            location=global_coord)
bpy.data.meshes.remove(obj_mesh)


In case you missed it, the link provided by @tet_li in comments provides a detailed explanation of coordinates in blender.