I'm trying to parse a log file for all ip addresses but can't get my RE to
work. Thanks in advance for pointing me in the right direction
#IP address parse
##
import re
infile = open("host0_declare.txt","r")
outfile = open("out.txt","w")
patt = re.compile(\[0-9]{1,
at 5:15 AM
Subject: Re: [Tutor] Simple copy script
To: tutor@python.org
"Que Prime" <[EMAIL PROTECTED]> wrote
> I'm trying to copy files from one directory to another based on an
> input txt
> file containing the filename.
>
> Source directory = C:\test
>
I'm trying to copy files from one directory to another based on an input txt
file containing the filename.
Source directory = C:\test
Destination directory = C:\output
input.txt looks like:
12345.pdf
12344.pdf
I having trouble getting my mind around a loop that would accomplish this.
_
I have a folder of 150,000 pdf files and I need to copy 20,000 of them to
another folder. The ones I need to copy are in a .txt file. Attached is a
sample of the input .txt file and a dos directory of the folder containing
the files. I'm not sure of the best way to accomplish this.
Thank you in
I need to pull the highligted data from a similar file and can't seem to get
my script to work:
Script:
import re
infile = open("filter.txt","r")
outfile = open("out.txt","w")
patt = re.compile(r"~02([\d{10}])")
for line in infile:
m = patt.match(line)
if m:
outfile.write("%s\n")
infile.cl
With the help of a tutor I was able to get the following code to work the
way I want, but I'd like for it to parse through several files in one folder
and create one output file.
I'm thinking I need to add something like:
def grab_files(files = []):
found = []
if files != None:
Here is
This script appears to be written for Unix systems. Is there a way to get
it to work for PythonWin?
from random import randint, choice
from string import lowercase
from sys import maxint
from time import ctime
doms = ( 'com', 'edu', 'net', 'org', 'gov' )
for i in range(randint(5, 10)):
dtin
I'm trying to parse a file and extract 'src=172.16.148.27 dst=10.52.10.10'
out of each line that contains 10.52.10.10, but get lost with writing the
information and am not sure if I should .re at all.
import re
infile = open("in.txt","r")
outfile = open("out.txt", "w")
for line in infile:
r
I'm working on the following code to read a log file and output lines
containing '10.52.10.10' but am unsure of whether to use a regular
expression or string to achive this. Can someone please enlighten me? Thank
you.
infile = open("in.txt","r")
outfile = open("out.txt", "w")
for line in infil
I'm trying to create a program that creates a file and write the number for
each line. Here is what I have so far but can't seem to get the loop and
write correct.
Thanks in advance.
print "Creating txt file"
tfile = open("25.txt", "w")
for i in range(25):
x = int(1)
tfile.writelines("x
10 matches
Mail list logo