Once again my specs were incomplete.
By largest I mean exactly what you pointed out as in sum(map(len,
setlist)).
I think this might work--sorting of the initial list should do the
trick.
1) sort the sets by size (in decending order)
2) put the first (largest) into a new list (Lu)
for s in Lnew[1:
OK, so I need to be more precise.
Given a list of sets, output the largest list of sets (from this list,
order does not matter) such that:
1) there is no set that is a PROPER subset of another set in this list
2) no two sets have exactly the same members (100% overlap)
Seems like this problem is m
Hi,
matlab has a useful function called "textread" which I am trying to
reproduce
in python.
two inputs: filename, format (%s for string, %d for integers, etc and
arbitary delimiters)
variable number of outputs (to correspond to the format given as
input);
So suppose your file looked like this
s
Hi,
I have many set objects some of which can contain same group of object
while others can be subset of the other. Given a list of sets,
I need to get a list of unique sets such that non of the set is an
subset of another or contain exactly the same members.
Tried to do the following:
s1=set(['a'
Hi,
support I have a library of function, called mylib.py, in which
there are 2 functions 'f1' and 'f2' (1 arguments in either one);
Now I want to write a wrapper that will invoke f1 or f2 using the
command line argument. So for example, I want to write a function
"call.py" and invoke it as
pytho
Hi,
I have 2 lists of tuples that look like:
E1=[('a','g'),('r','s')] and
E2=[('g','a'),('r','q'),('f','h')].
In this tuple, the ordering does not
matter, i.e. (u,v) is the same as (v,u).
What I want to do is the following:
given 2 list of tuples, E1 and E2, I want to create another list with
tupl
Hi,
i am so use to perl's regular expression that i find it hard
to memorize the functions in python; so i would appreciate if
people can tell me some equivalents.
1) In perl:
$line = "The food is under the bar in the barn.";
if ( $line =~ /foo(.*)bar/ ) { print "got <$1>\n"; }
in python, I don't
Hi,
I know that i can do readline() from a file object.
However, how can I read till a specific seperator?
for exmple,
if my files are
name
profession
id
#
name2
profession3
id2
I would like to read this file as a record.
I can do this in perl by defining a record seperator;
is there an equivalen
Yes, this is exactly what I wanted--just like in perl I can add search
path to @inc.
thanks
--
http://mail.python.org/mailman/listinfo/python-list
Dear all,
i have a simple question.
Suppose I have my classes such as
myClass1.py
myClass2.py
etc
which I keep in a special folder ~/py_libs
Now
suppose I have a program that is not in py_libs
but I want to do
import myClass1 # note: myClass1 is not in the current directory
how can I set the sear
I should have also said that I am using the same file handle.
So suppose the file handle is fp
then I read some lines from fp and I hand it over to other
functions that read other things from fp (in an ordered manner).
les
--
http://mail.python.org/mailman/listinfo/python-list
OK, I am sorry , I did not explain my problem completely.
I can easily break from the loop when I see the character in a line
that I just read; however my problem involves putting back the line I
just read since if I have seen this special character, I have read one
line too many. Let me illustrate
Hi,
suppose I am reading lines from a file or stdin.
I want to just "peek" in to the next line, and if it starts
with a special character I want to break out of a for loop,
other wise I want to do readline().
Is there a way to do this?
for example:
while 1:
line=stdin.peek_nextline()
if not line:
13 matches
Mail list logo