本文整理汇总了Python中strop.join方法的典型用法代码示例。如果您正苦于以下问题:Python strop.join方法的具体用法?Python strop.join怎么用?Python strop.join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类strop
的用法示例。
在下文中一共展示了strop.join方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_join
# 需要导入模块: import strop [as 别名]
# 或者: from strop import join [as 别名]
def test_join(self):
self.assertTrue(strop.join(['a', 'b', 'c', 'd']) == 'a b c d')
self.assertTrue(strop.join(('a', 'b', 'c', 'd'), '') == 'abcd')
self.assertTrue(strop.join(Sequence()) == 'w x y z')
# try a few long ones
self.assertTrue(strop.join(['x' * 100] * 100, ':')
== (('x' * 100) + ":") * 99 + "x" * 100)
self.assertTrue(strop.join(('x' * 100,) * 100, ':')
== (('x' * 100) + ":") * 99 + "x" * 100)
示例2: test_stropjoin_huge_list
# 需要导入模块: import strop [as 别名]
# 或者: from strop import join [as 别名]
def test_stropjoin_huge_list(self, size):
a = "A" * size
try:
r = strop.join([a, a], a)
except OverflowError:
pass
else:
self.assertEqual(len(r), len(a) * 3)
示例3: test_stropjoin_huge_tup
# 需要导入模块: import strop [as 别名]
# 或者: from strop import join [as 别名]
def test_stropjoin_huge_tup(self, size):
a = "A" * size
try:
r = strop.join((a, a), a)
except OverflowError:
pass # acceptable on 32-bit
else:
self.assertEqual(len(r), len(a) * 3)
示例4: test_join
# 需要导入模块: import strop [as 别名]
# 或者: from strop import join [as 别名]
def test_join(self):
self.assert_(strop.join(['a', 'b', 'c', 'd']) == 'a b c d')
self.assert_(strop.join(('a', 'b', 'c', 'd'), '') == 'abcd')
self.assert_(strop.join(Sequence()) == 'w x y z')
# try a few long ones
self.assert_(strop.join(['x' * 100] * 100, ':')
== (('x' * 100) + ":") * 99 + "x" * 100)
self.assert_(strop.join(('x' * 100,) * 100, ':')
== (('x' * 100) + ":") * 99 + "x" * 100)
示例5: test_stropjoin_huge_list
# 需要导入模块: import strop [as 别名]
# 或者: from strop import join [as 别名]
def test_stropjoin_huge_list(self, size):
a = "A" * size
try:
r = strop.join([a, a], a)
except OverflowError:
pass
else:
self.assertEquals(len(r), len(a) * 3)
示例6: test_stropjoin_huge_tup
# 需要导入模块: import strop [as 别名]
# 或者: from strop import join [as 别名]
def test_stropjoin_huge_tup(self, size):
a = "A" * size
try:
r = strop.join((a, a), a)
except OverflowError:
pass # acceptable on 32-bit
else:
self.assertEquals(len(r), len(a) * 3)