Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一串表格
" This year is 2014"
我想将字符串分成两部分
part1="This year is" part2="2014"
在空格后跟一个数字拆分,如下所示:
>>> part1, part2 = re.split(r'\s(?=\d)', " This year is 2014", 1) >>> part1, part2 (' This year is', '2014')