How do I make this code print lines NOT containing the string 'Domains'?
import re
for line in log:
if re.search (r'Domains:', line):
print line
This does not work...
if re.search != (r'Domains:', line):
___
Tutor maillist - Tutor@pytho
Nick Burgess wrote:
> How do I make this code print lines NOT containing the string 'Domains'?
>
>
> import re
> for line in log:
> if re.search (r'Domains:', line):
> print line
>
>
> This does not work...
>
> if re.search != (r'Domains:', line):
re.search (r'Domains:', line)
is
"Nick Burgess" wrote
How do I make this code print lines NOT containing the string 'Domains'?
Don't use regex, use in:
for line in log:
if "Domains" in line:
print line
This does not work...
if re.search != (r'Domains:', line):
Because you are assigning a tuple containing
Alan Gauld wrote:
>> if re.search != (r'Domains:', line):
>
> Because you are assigning a tuple containing a string and a line of text
> to a name which is currently bound to a function object (re.search)
Actually, he's COMPARING the two, not assigning. But comparing a
function object and a tupl
"Steve Willoughby" wrote
if re.search != (r'Domains:', line):
Because you are assigning a tuple containing a string and a line of text
to a name which is currently bound to a function object (re.search)
Actually, he's COMPARING the two, not assigning. But comparing a
function object and a
"Alan Gauld" wrote
How do I make this code print lines NOT containing the string 'Domains'?
Don't use regex, use in:
for line in log:
if "Domains" in line:
print line
Should, of course, be
if "Domains" not in line:
print line
Alan G.
_
hi everyone, I'm a bit new here but i was wondering if someone could check
some of my code, it's not doing quite what it's meant to.
thanks
Databox_2_0.py:
import pygame, sys, os
pygame.init()
def load(filename):
if filename != '':
e = 1
dec = "placeholder"
fic = open(
Jacob Mansfield wrote:
hi everyone, I'm a bit new here but i was wondering if someone could
check some of my code, it's not doing quite what it's meant to.
thanks
Works without pygame;
filename, blank for none.
Welcome to databox V2.0.
1. Searth the database.
2. Add a record.
3.
Hi tutors,
I am working on a file and need to replace each occurrence of a certain
label (part of speech tag in this case) by a number of sub-labels. The file
has the following format:
word1 \tTag1
word2 \tTag2
word3 \tTag3
Now the tags are complex and I wanted to split them in a
David wrote:
Jacob Mansfield wrote:
hi everyone, I'm a bit new here but i was wondering if someone could
check some of my code, it's not doing quite what it's meant to.
thanks
Why were you using pygame?
The only line that uses pygame is pygame.time.delay(900). It is an
overkill to import
Jacob Mansfield wrote:
> hi everyone, I'm a bit new here but i was wondering if someone could check
> some of my code, it's not doing quite what it's meant to.
As a general remark: it's a good idea to add a note on what your code is
supposed to do, and in what way it behaves unexpectedly, i.e. wha
11 matches
Mail list logo