Python:将数字拆分为两部分



我对python很陌生,我想拆分一个字符串,比如"12〃;或";1234";通过将中间的字符串用"1"分隔成两部分&";。例如:";12〃-->quot;12〃"1234"-->quot;12 34";

我该怎么做?我已经用split((尝试了很多次了,但我就是不能让它成为

伪码:

split("12")

result = "1 2"

实现的一种方法

a = '1234'
splitter = len(a)//2
print(a[:splitter], a[splitter:])

最新更新