如何让输出排成一行而不是多行? (木星笔记本)

How do I get the outputs to be in one row, instead of multiple? (Jupyter Notebook)

如何将输出排成一行而不是多排?

这是我的代码:

import random
Lu=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
Ll=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
N=['1','2','3','4','5','6','7','8','9']
S=['!','@','#','$','%','&','*']
def rp(num):
    for r in range(num):
        P1=random.choice(Lu)
        print(P1)
rp(10)

这是输出:

U

J

K

W

Q

Q

T

O

V

R

import random
Lu=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
Ll=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
N=['1','2','3','4','5','6','7','8','9']
S=['!','@','#','$','%','&','*']
def rp(num):
    for r in range(num):
        P1=random.choice(Lu)
        print(P1 ,end = ' ')
rp(10)