我对Python还不熟悉,完全被.join()
搞糊涂了,我读到这是连接字符串的首选方法。
我尝试过:
strid = repr(595)
print array.array('c', random.sample(string.ascii_letters, 20 - len(strid)))
.tostring().join(strid)
然后得到了类似这样的东西:
5wlfgALGbXOahekxSs9wlfgALGbXOahekxSs5
为什么它会这样工作?595
不应该自动追加吗?