Re: [问题] 切字串 split

楼主: shadowjohn (转角遇到爱)   2018-03-21 14:15:47
※ 引述《ctr1 (【积π】)》之铭言:
: 后来发现当内容太长时还需要换行
: =?utf-8?B?W0lUIERhdGEgUmVxdWVzdCBTeXN0ZW1dIFRoZSBkb2N1bWVudCBpcyByZWFz?=
: =?utf-8?B?c2lnbiA+PiDoq4vkv67mraMg5aGr5ZauIOe/kuaFoywgICAgICgqKiBTZWN1?=
: =?utf-8?B?cml0eSBDKiop?=
: 请问这样要怎么把红色的字串起来处理比较好
: 有够复杂的啦
: 谢谢各位前辈
: : s = "b'=?utf-8?B?UmU6IOaEn+isneS/oSAgICgqKiBTZWN1cml0eSBDKiop?='"
: : x = "b'=?utf-8?B?"
: : m1 = s.split(x)[1]
: : m2 = m1.split("?='")[0]
: : print(m2)
s1 = "b'=?utf-8?B?UmU6IOaEn+isneS/oSAgICgqKiBTZWN1cml0eSBDKiop?='"
s2 =
"b'=?utf-8?B?W0lUIERhdGEgUmVxdWVzdCBTeXN0ZW1dIFRoZSBkb2N1bWVudCBpcyByZWFz?='"
s3 =
"b'=?utf-8?B?c2lnbiA+PiDoq4vkv67mraMg5aGr5ZauIOe/kuaFoywgICAgICgqKiBTZWN1?='"
s4 = "b'=?utf-8?B?cml0eSBDKiop?='"
print(s1[12:-3])
print(s2[12:-3])
print(s3[12:-3])
print(s4[12:-3])
C:\Users\3wa>python bbb.py
UmU6IOaEn+isneS/oSAgICgqKiBTZWN1cml0eSBDKiop
W0lUIERhdGEgUmVxdWVzdCBTeXN0ZW1dIFRoZSBkb2N1bWVudCBpcyByZWFz
c2lnbiA+PiDoq4vkv67mraMg5aGr5ZauIOe/kuaFoywgICAgICgqKiBTZWN1
cml0eSBDKiop
C:\Users\3wa>

Links booklink

Contact Us: admin [ a t ] ucptt.com