Big thank you to everyone who offered their help!
On 03/06/2016 11:38 PM, Fillmore wrote:
--
https://mail.python.org/mailman/listinfo/python-list
Fillmore wrote:
>
> Hi, I'm trying to move away from Perl and go to Python.
> Regex seems to bethe hardest challenge so far.
>
> Perl:
>
> while () {
> if (/(\d+)\t(.+)$/) {
> print $1." - ". $2."\n";
> }
> }
>
> into python
>
> pattern = re.compile(r"(\d+)\t(.+)$")
> with open(fiel
Also for regex hacking:
Try with findall before using match/search
--
https://mail.python.org/mailman/listinfo/python-list
Also for regex hacking:
Try with findall before using match/search
--
https://mail.python.org/mailman/listinfo/python-list
On 3/6/2016 11:38 PM, Fillmore wrote:
Hi, I'm trying to move away from Perl and go to Python.
Regex seems to bethe hardest challenge so far.
Perl:
while () {
if (/(\d+)\t(.+)$/) {
print $1." - ". $2."\n";
}
}
into python
pattern = re.compile(r"(\d+)\t(.+)$")
with open(fields_I
On Mon, Mar 7, 2016 at 3:38 PM, Fillmore wrote:
> pattern = re.compile(r"(\d+)\t(.+)$")
> with open(fields_Indexfile,mode="rt",encoding='utf-8') as headerfile:
> for line in headerfile:
> #sys.stdout.write(line)
> m = pattern.match(line)
> print(m.group(0))
> header