Re: [Tutor] How to substitute an element of a list as a pattern for re.compile()

2004-12-30 Thread Kent Johnson
kumar s wrote: My situation: I have a list of numbers that I have to match in another list and write them to a new file: List 1: range_cors range_cors[1:5] ['161:378', '334:3', '334:4', '65:436'] List 2: seq seq[0:2] ['>probe:HG-U133A_2:1007_s_at:416:177; Interrogation_Position=3330; Antisense;',

RE: [Tutor] How to substitute an element of a list as a pattern for re.compile()

2004-12-29 Thread Rich Krauter
kumar s wrote: I have Question: How can I substitute an object as a pattern in making a pattern. x = 30 pattern = re.compile(x) Kumar, You can use string interpolation to insert x into a string, which can then be compiled into a pattern: x = 30 pat = re.compile('%s'%x) I really doubt regular

[Tutor] How to substitute an element of a list as a pattern for re.compile()

2004-12-29 Thread kumar s
Hi Group: I have Question: How can I substitute an object as a pattern in making a pattern. >>> x = 30 >>> pattern = re.compile(x) My situation: I have a list of numbers that I have to match in another list and write them to a new file: List 1: range_cors >>> range_cors[1:5] ['161:378',