<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with weighted edges, can you use the NetworkX function to_dict_of_dicts to export the graph to a dictionary of dictionaries, including only the 'weight' attribute for the edges?
### Response:
import networkx as nx

# Create a graph
G = nx.DiGraph()

# Add some edges
G.add_edge('A', 'B', weight=4)
G.add_edge('B', 'C', weight=7)

# Export the graph to a dictionary of dictionaries
graph_dict = nx.to_dict_of_dicts(G, edge_data=['weight'], data=True)

# Print the resulting dictionary
print(graph_dict)
<|EOT|>
