<｜begin▁of▁sentence｜>### Instruction:
Given a text file 'path_to_file.txt' that contains a weighted edge list, with each line representing an edge followed by a numeric weight, how can you create a NetworkX graph from this file and display the edges with their associated weights?
### Response:
import networkx as nx

# Read the weighted edge list from a file
G = nx.read_weighted_edgelist('path_to_file.txt', nodetype=int, encoding='utf-8')

# Print the edges with weights
for (u, v, wt) in G.edges(data=True):
    print(f'({u}, {v}, {wt['weight']})')
<|EOT|>
