How to interpret Blenders python tips when hovering
The command you want is:
bpy.context.scene.world.node_tree.nodes["Background"].inputs["Color"].default_value

This will access the background color of the world in the current scene.

Your command doesn't work, because you're not in the right context. If you're in the scripting workspace and take a look at the bottom left window, you'll see that before bpy.data.node_groups["Shader Nodetree"].nodes["Background"].inputs[0].default_value = (0, 0, 0, 1) is bpy.context.space_data.context = 'WORLD'. In the wrong context it's entirely unclear which node tree you're trying to access. That being said, I don't know why the command in printed as it is, because even in the color picker it would rely on the context passed to the panel and not access data like this (because it wouldn't work either).

The Blender Python API docs are always helpful, as well as CTRL+SPACE in the Python console for possible options.