小编VNG*_*NGu的帖子

Adding spaces to string based on list

I have a string s and a list of strings, arr. The length of s is equal to the total length of strings in arr. I need to split s into a list, such that each element in the list has the same length as the corresponding element in arr.

For example:

s = 'Pythonisanprogramminglanguage'

arr = ['lkjhgf', 'zx', 'qw', 'ertyuiopakk', 'foacdhlc']
Run Code Online (Sandbox Code Playgroud)
s = 'Pythonisanprogramminglanguage'

arr = ['lkjhgf', 'zx', 'qw', 'ertyuiopakk', 'foacdhlc']
Run Code Online (Sandbox Code Playgroud)

python split list

3
推荐指数
3
解决办法
526
查看次数

标签 统计

list ×1

python ×1

split ×1