Shu, 06.04.2010 01:06:
I have a CAPI extension module that is giving me MemoryError
exceptions from once in a while with no other information
MemoryError is a bit special in that it usually only occurs when memory
allocation fails, in which case raising a new exception object would likely
al
Hi,
I am new to python, and specially to file handling.
I need to write a program which reads a unique string in a file and
corresponding to the unique string, extracts/reads the n-th line (from the
line in which the unique string occurs).
I say 'n-th line' as I seek a generalized way of doing
I got it. I was comparing '345' to '345\n'
Adding the '\n' to the slice did indeed do the trick.
#!/usr/bin/env python
import string
def main():
infile = open("filex")
outfile = open("results_testx", "w")
zips = open("zippys", "r")
match_zips = zips.readlines()
lines =
OK - you handled the problem regarding reading to end-of-file. Yes it
takes a lot longer, because now you are actually iterating through
match_zips for each line.
How large are these files? Consider creating a set from match_zips. As
lists get longer, set membership test become faster than list
On 04/06/10 08:05, Neven Goršić wrote:
> OK, I will describe my "case".
>
> I use menu date stored in list "shape" in file CMFlowData.py in the same
> directory as my main program x.py. In the beginning of the program I
> have command:
>
> import CMFlowData
>
> and everything works fine till I m
On 6 April 2010 03:31, Roy Hinkelman wrote:
> I am using urllib2 to open some government pages, and they have some js
> checking for Flash on my computer.
> Is there a way to show them that I have flash? Or possibly another solution?
>From reading the JavaScript, you should fetch the URL
domain.t
On Tue, 6 Apr 2010 06:31:30 am Marco Rompré wrote:
> Hi im doin a programmin course at university and in one on my
> exercise i have to do that
>
> I had to define a class CompteBancaire(CompteBancaire is bankaccount
> in french), that would allow me to create objects Compte1,
> Compte2,etc.
[...]
Hi,
I have a CAPI extension module that is giving me MemoryError
exceptions from once in a while with no other information, so clearly
none of my exception handlers are catching it. Is there any way I can
traceback information for the extension module?
Thanks in advance,
.S
__
I don't speak French so I'm struggling a bit with the variable
names, however...
"Marco Rompré" wrote in message
class CompteBancaire:
def __init__(self,nom,solde,interet): #Nous allons instancier et
self.nom, self.solde, self.interet = nom,solde,interet
def depot(self,somme
OK, I will describe my "case".
I use menu date stored in list "shape" in file CMFlowData.py in the same
directory as my main program x.py. In the beginning of the program I have
command:
import CMFlowData
and everything works fine till I make executable with py2exe. There are no
error during "co
I do not know the code to move the traversal.
Maze = [ [
'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
[
'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'
],\
[
'#','#','#','#','#','#','#','#','#','#','#','#','
Hi im doin a programmin course at university and in one on my exercise i
have to do that
I had to define a class CompteBancaire(CompteBancaire is bankaccount in
french), that would allow me to create objects Compte1, Compte2,etc.
The following methods need to be defined
- depot(somme)
"Vincent Davis" wrote
class BString(XString):
""" Biological string """
_bstring_constructor = biostrings.BString
@classmethod
def new(cls, x):
""" :param x: a (biological) string """
res = cls(cls._bstring_constructor(conversion.py2ri(x)))
_setExtractDelegato
"Vincent Davis" wrote
Take a look at the repr and str methods:
http://docs.python.org/reference/datamodel.html#basic-customization
Ok so I am still a little confused, It seems that __str__ is used for
print
and str()
That's right and repr() is used when evaluating the object, as at the >>
>
> That' a very strange idiom in Python.
> Can you show us the class definition?
It's a bioconductor extension to rpy2
http://www.bitbucket.org/lgautier/rpy2-bioc-extensions/overview/
I am trying to learn R and at they same time more about python and R
bioconductor packages. So no it is not home
"Vincent Davis" wrote
I am working an a open source project and would like to add feature to a
class.
Current action:
in:>>>b = BString.new('I am a BString object')
That' a very strange idiom in Python.
Can you show us the class definition?
out: >>>b
in:>>>
in:>>>print(b)
out:
Take a look at the repr and str methods:
http://docs.python.org/reference/datamodel.html#basic-customization
Ok so I am still a little confused, It seems that __str__ is used for print
and str()
byt what allows whats below. That is why does just entering the name of the
instance return print(b).
Interesting.
I am using urllib2 to open some government pages, and they have some js
checking for Flash on my computer.
Is there a way to show them that I have flash? Or possibly another solution?
My code:
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = {'User-Agent' : us
On Mon, Apr 5, 2010 at 12:08 PM, Vincent Davis wrote:
> I am working an a open source project and would like to add feature to a
> class.
> Current action:
> in:>>>b = BString.new('I am a BString object')
> out: >>>b
> in:>>>
> in:>>>print(b)
> out: >>> 21-letter "BString" instance
>
I am working an a open source project and would like to add feature to a
class.
Current action:
in:>>>b = BString.new('I am a BString object')
out: >>>b
in:>>>
in:>>>print(b)
out: >>> 21-letter "BString" instance
seq: I am a BString object
What I would like is to be ab
On 04/05/10 17:39, Neven Goršić wrote:
> Thank you for mentioning the possible options.
> I already use option where I import .py module,
> but I run into troubles when making executable with py2exe.
Maybe you should elaborate what problems you're experiencing with
py2exe? Probably we can solve th
On 4/5/2010 1:15 AM, TGW wrote:
Sorry - my mistake - try:
infile = open("filex")
match_zips = open("zippys")
result = [line for line in infile if line in match_zips]
print result
When I apply the readlines to the original file, It is taking a lot
longer to process and the outfile still remains
Thank you for mentioning the possible options.
I already use option where I import .py module,
but I run into troubles when making executable with py2exe.
I suppose that XML approach is the most general method.
Can you recommend a good introduction text (not for experts :-))
and give more details
Please use Reply All whern responding to the list.
> lines = [line for line in infile if line[149:154] not in match_zips]
>
>Nope. I tried that. I actually modified your comprehension
>that you provided about a month ago.
>Works great for NOT matching, but can't figure out how to match.
>Do
24 matches
Mail list logo