Problem:
将若干个字符串合并到一起
Solution:
使用 ''.join()来实现对字符串列表的合并。(效率较高)
largestring = ''.join(smallpieces)
使用%格式符号
largeString = '%s%s something %s yet more' % (small1, small2, small3)
或使用 reduce()
import operator
largeString = reduce(operator.add, pieces, '')
将若干个字符串合并到一起
Solution:
使用 ''.join()来实现对字符串列表的合并。(效率较高)
largestring = ''.join(smallpieces)
使用%格式符号
largeString = '%s%s something %s yet more' % (small1, small2, small3)
或使用 reduce()
import operator
largeString = reduce(operator.add, pieces, '')

浙公网安备 33010602011771号