Banh banh0...@gmail.com writes:
Hi,
I have a problem with learning Python. My code is really bad and I can't
solve many problems. I really want to improve it. Do you know any website
which helps me to learn python effectively (for beginners)? This is my first
programming language and I am
- Original Message -
Hi,
I have a problem with learning Python. My code is really bad and I
can't solve many problems. I really want to improve it. Do you know
any website which helps me to learn python effectively (for
beginners)? This is my first programming language and I am
On Feb 6, 4:52 am, Banh banh0...@gmail.com wrote:
Hi,
I have a problem with learning Python. My code is really bad and I can't
solve many problems. I
really want to improve it. Do you know any website which helps me to learn
python effectively (for
beginners)? This is my first programming
Hi,
I have a problem with learning Python. My code is really bad and I can't solve
many problems. I really want to improve it. Do you know any website which helps
me to learn python effectively (for beginners)? This is my first programming
language and I am studying about manipulating the
elements_present = lambda seq, match: any(((x in match) for x in seq))
On Mon, 14 Sep 2009 19:08:59 -0600, Oltmans rolf.oltm...@gmail.com wrote:
Hello,
Is there someway I can improve the following code(pythonically)?
(Copying from IDLE)
match=[1,2,3,4,5]
def elementsPresent(aList):
From a private email, forwarded to the list:
-- Forwarded Message --
Subject: Re: How to improve this code?
Date: Tuesday 15 September 2009
From: Oltmans rolf.oltm...@gmail.com
To: hend...@microcorp.co.za
On Sep 15, 1:13 pm, Hendrik van Rooyen hend...@microcorp.co.za
wrote
otherwise. Given this, I'm just trying to write a method
are_elements_present(aList) whose job is to return True if and only if
all elements in aList are present in page's HTML. So here is how
missingItems = [str(ele) for ele in eleLocators if not
selenium.is_element_present(ele)]
if
Hendrik van Rooyen hend...@microcorp.co.za wrote:
def are_elements_present(eleLocators):
elePresent=False
if not eleLocators:
return False
for ele in eleLocators:
if selenium.is_element_present(ele):
elePresent=True
else:
On Tuesday 15 September 2009 03:08:59 Oltmans wrote:
match=[1,2,3,4,5]
def elementsPresent(aList):
result=False
if not aList:
return False
for e in aList:
if e in match:
result=True
else:
def are_elements_present(sourceList, searchList):for e in searchList:
if e not in sourceList:
return False
return True
Using set:
def are_elements_present(sourceList, searchList):
return len(set(sourceList).intersection(set(searchList)) ==
Sol Toure wrote:
def are_elements_present(sourceList, searchList):for e in searchList:
if e not in sourceList:
return False
return True
Using set:
def are_elements_present(sourceList, searchList):
return
Tim Golden wrote:
Unless I'm missing something, (and I didn't bother to
read the original code so I may be) that's a subset test:
set (searchList) = set (searchList)
(cough) or, rather:
set (searchList) = set (sourceList)
TJG
--
http://mail.python.org/mailman/listinfo/python-list
Oltmans wrote:
On Sep 15, 1:13 pm, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
(i) a True if All the elements in match are in aList, else False?
(ii) a True if any one or more of the members of match are in aList?
(iii) Something else?
That's a good question because I
On Mon, 14 Sep 2009 18:33:17 -0700 (PDT) André
andre.robe...@gmail.com wrote:
Here's an example using sets:
def is_present(list_1, list_2):
...if set(list_1).intersection(set(list_2)):
... return True
...return False
...
Not that it matters, but I'd probably write:
def
Hello,
Is there someway I can improve the following code(pythonically)?
(Copying from IDLE)
match=[1,2,3,4,5]
def elementsPresent(aList):
result=False
if not aList:
return False
for e in aList:
if e in match:
Oltmans schrieb:
Hello,
Is there someway I can improve the following code(pythonically)?
(Copying from IDLE)
match=[1,2,3,4,5]
def elementsPresent(aList):
result=False
if not aList:
return False
for e in aList:
if e in match:
On Sep 14, 10:16 pm, Diez B. Roggisch de...@nospam.web.de wrote:
Oltmans schrieb:
Hello,
Is there someway I can improve the following code(pythonically)?
(Copying from IDLE)
match=[1,2,3,4,5]
def elementsPresent(aList):
result=False
if not aList:
return False
def elementsPresent(aList, match):
match = set(match)
for item in aList:
if item in match:
return True
return False
This could be rewritten in Python2.5+ as
def elementsPresent(aList, match):
match = set(match)
return any(elem in match for elem in
18 matches
Mail list logo