We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Regex and Parsing
- Matrix Script
- Discussions
Matrix Script
Matrix Script
Sort by
recency
|
573 Discussions
|
Please Login in order to post a comment
was trying numpy, but no such module
string = ''.join([''.join(y) for y in (np.array([list(x) for x in matrix]).T.tolist())])
Disappointed to see no answer using findall directly (I know why). Here is my solution with findall
print(re.sub("(?<=\w)(\W+)(?=\w)"," ","".join([matrix[j][i] for i in range(m) for j in range(n)])))