<｜begin▁of▁sentence｜>### Instruction:
As an electrical technician working on a complex electrical system for a large building, I need to retrieve and print the specific weights of the various cables being used throughout the network. Can you use an API like NetworkX to access this information and display the 'weight' attribute for each cable in the system, such as cable load capacity or resistance? Thank you.
### Response:
import networkx as nx

# Create a graph and add edges with attributes
g = nx.Graph()
g.add_edge(1, 2, weight=4.7)
g.add_edge(2, 3, attribute='edge_value')
g.add_edge(3, 4, color='blue')

# Retrieve edge attributes for all edges in the graph
edge_attrs = nx.get_edge_attributes(g, 'weight')
print(edge_attrs)
<|EOT|>
