J'ai besoin d'aide pour déclarer une expression régulière. Mes entrées sont les suivantes:
this is a paragraph with<[1> in between</[1> and then there are cases ... where the<[99> number ranges from 1-100</[99>.
and there are many other lines in the txt files
with<[3> such tags </[3>
La sortie requise est:
this is a paragraph with in between and then there are cases ... where the number ranges from 1-100.
and there are many other lines in the txt files
with such tags
J'ai essayé ça:
#!/usr/bin/python
import os, sys, re, glob
for infile in glob.glob(os.path.join(os.getcwd(), '*.txt')):
for line in reader:
line2 = line.replace('<[1> ', '')
line = line2.replace('</[1> ', '')
line2 = line.replace('<[1>', '')
line = line2.replace('</[1>', '')
print line
J'ai également essayé ceci (mais il semble que j'utilise la mauvaise syntaxe regex):
line2 = line.replace('<[*> ', '')
line = line2.replace('</[*> ', '')
line2 = line.replace('<[*>', '')
line = line2.replace('</[*>', '')
Je ne veux pas coder en dur le replace
1 à 99. . .
where the<[99> number ranges from 1-100</[100>
?
<...>
balise, donc la sortie devrait êtrewhere the number rangers from 1-100 ?