本文整理匯總了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)