#!/usr/bin/python
import random
lower_a = ['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']
upper_a = ['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']
num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
all = []
all = "".join("".join(lower_a) + "".join(upper_a) + "".join(num))
all = all.split()
x = 0
while x < 10:
for i in range(7):
a = random.choice(all)
print a,
print
x += 1
我想要做的是从输出中删除空格。它现在给出的是:
Z 3 a A I K R
G B i N 9 c E
v g E r A N 8
e B 6 d v H O
c a V 8 c x y
b g 2 W a T T
f 8 H T r 6 E
p D K l 5 p u
x q 8 P Z 9 T
n I W X n B Q