I’m using python and I’m simply trying to split a string on white characters (white spaces, tab, new line, etc.) and put it on an array. If I use:
result_array = result.split("\s+")
it doesn’t works. What I’m doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to split on whitespace itself just use
split()with no arguments. Thesplit()for strings doesn’t take a regular expression, though there is anre.split()function that will allow you to split based on a regular expression if you need.