I have a string in this format: any_string = "[u'02', u'03', u'04', u'05']".
I want to extract a list from this which should look like new_list = ['02', '03', '04', '05']
I am using ‘re’. The below code i am writing to get this work done, but no luck
import re
new_list = re.findall(r'["w "]', any_string)
I am getting the result as [' ', ' ', ' ']
Basically I want a list like this new_list = ['02', '03', '04', '05'], so that i can loop through the individual items like 02, 03, 04 , 05
If you aren’t tied to
re, what aboutast? Just one more letter 🙂