小编bor*_*ted的帖子

在matlab中将字符串拆分为两部分

输入字符串是:

InputStr1 = 'this-is-a-boy-5';
InputStr2 = 'this23-is-a-boy-10';
InputStr3 = 'this-41';
Run Code Online (Sandbox Code Playgroud)

输出应该是:

Output1 = ['this-is-a-boy'] [5]
Output2 = ['this23-is-a-boy'] [10]
Output3 = ['this'] [41]
Run Code Online (Sandbox Code Playgroud)

我想将这些字符串分成两部分,这样我就可以将第一个字符串和最后一个字符分开.我试过strsplit()但它没有帮助.

regex matlab strsplit

2
推荐指数
1
解决办法
365
查看次数

基于python中每个列表元素中的一些分隔符将列表拆分为两部分

我有一个python列表

my_list = ['owner/NN', 'is/VBZ', 'pleasant/JJ', 'and/CC', 'entertaining/JJ', './.']
Run Code Online (Sandbox Code Playgroud)

我想将它分成两部分(基于每个列表元素中显示的分隔符'/'),这样我就可以得到两个单独的列表

my_list_1 = ['owner', 'is', 'pleasant', 'and', 'entertaining', '.']
my_list_2 = ['NN', 'VBZ', 'JJ', 'CC', 'JJ', '.']
Run Code Online (Sandbox Code Playgroud)

python split python-3.x

1
推荐指数
1
解决办法
51
查看次数

标签 统计

matlab ×1

python ×1

python-3.x ×1

regex ×1

split ×1

strsplit ×1