Python列表转换成字符串
2019-12-10 本文已影响0人
月夜星空下
# encoding=utf8
import random
a = range(1, 20)
b = random.sample(a, 5)
r = ''
for i in b:
b = str(b)
i = str(i)
r += i
print(r)
>>>8132129
# encoding=utf8
import random
a = range(1, 20)
b = random.sample(a, 5)
r = ''
for i in b:
b = str(b)
i = str(i)
r += i
print(r)
>>>8132129