+ 1

Create list with regular expressions

How do you create a list with the regular expressions of the elements in another list?

27th Mar 2018, 4:00 PM
Bernardo Bernardino Gameiro
Bernardo Bernardino Gameiro - avatar
4 ответов
+ 4
So you need to use re.compile() method: https://pymotw.com/2/re/#compiling-expressions
27th Mar 2018, 4:27 PM
visph
visph - avatar
+ 2
It sound like you're confusing between "regular expression" and "list comprehension" ^^ Do a google search about "python list comprehension" to get many explanations about them, among which: https://www.programiz.com/python-programming/list-comprehension
27th Mar 2018, 4:07 PM
visph
visph - avatar
0
@visph I'm trying to create a program with Tkinter that opens different apps. In order to do that I need to have the path to the app that will be opened. This path can't be a simple string. It needs to have the r before the path. Something like this: r"C:\\Program Files\\..." I have a list of the paths for each app. Now I would like to create a list with the same paths but with the r before each string. My problem is I can't put the r out of the "".
27th Mar 2018, 4:21 PM
Bernardo Bernardino Gameiro
Bernardo Bernardino Gameiro - avatar
26th Mar 2019, 5:40 AM
rahul kumar
rahul kumar - avatar