How to extract just one (random) batch from a data loader?

I constructed a data loader like this:

train_loader = torch.utils.data.DataLoader(
    datasets.MNIST('../data', transform=data_transforms, train=True, download=True),
    batch_size=batch_size, shuffle=True)

Now I want to extract one batch. I tried next(train_loader) but it doesn’t work. What can I do?

Nevermind, found the answer here!