Dave Angel wrote:
> On 03/05/2012 06:20 PM, Alan Gauld wrote:
>> On 05/03/12 21:25, Dave Angel wrote:
>>
>>> It's not clear what __add__() should mean for physical files.
>>
>> My guess would be similar to the cat operator in Unix:
>>
>> $ cat file1, file2 > file3
>>
>> is equivalent to
>>
>> file
Abhishek Pratap wrote:
> I have this one big string in python which I want to print to a file
> inserting a new line after each 100 characters. Is there a slick way to do
> this without looping over the string. I am pretty sure there shud be
> something its just I am new to the lang.
There is al
mjole...@gmail.com wrote:
> What is the purpose of getattr? Why not just use help or am I completely
> misunderstanding this?
>
>>From what I read, getattr allows you to get a reference to a function
>>without knowing its name until runtime.
>
> However, the example provided is:
>
> li = ['larr
Robert Sjoblom wrote:
> Okay, so here's a fun one. Since I'm on a japanese locale my native
> encoding is cp932. I was thinking of writing a parser for a bunch of
> text files, but I stumbled on even printing the contents due to ...
> something. I don't know what encoding the text file uses, which
Steven D'Aprano wrote:
> glyph. He shouldn't get a UnicodeDecodeError when printing. I smell a
> bug since print shouldn't be decoding anything. (At worst, it needs to
> *encode*.)
You have correctly derived the actual traceback ;)
[Robert]
> It starts to print until it hits the wonderful charac
Pete O'Connell wrote:
> Hello I print a lot of values at work using grep and need to be
> constantly opening a shell window to do this (rather than staying
> within my main program which is Nuke by the Foundry). Is there a
> simple equilavent to commands.getoutput that is more up to date (I
> woul
> Pete O'Connell wrote:
> Hi, I am using Python 2.6 I can't use Python 3 in this particular
situation.
[Please reply to the list, not in private mail.]
You can continue to use commands.getoutput() in 2.6 and 2.7, and once you
are ready to make the jump to 3.x replace it with subprocess.getoutp
Barry Drake wrote:
> On 30/03/12 16:19, Evert Rol wrote:
>> Not sure. In the sense that you can "optimise" (refactor) it in the same
>> way you could do with C. Eg: results = [0, 0, 0]
>> flags = [0, 1, 2, 3]
>> for flag in flags:
>> results = getflag(flag, results)
>>
>
> That's exactly wha
Alan Gauld wrote:
> On 03/04/12 15:54, Khalid Al-Ghamdi wrote:
>
>> dom="".join(choice(lc) for j in range (dlen))
>>
>> how does the interpreter know what "j" is supposed to refer to when it
>> was not mentioned prior?
>
> In Python variables are defined by using them.
>
> In the code belo
questions anon wrote:
> I have been able to write up what I want to do (using glob) but I am not
> sure how to loop it or simplify it to make the script more efficient.
> I am currently:
> -grouping the same months in a year using glob
> -opening the files in a group and combining the data using a
Khalid Al-Ghamdi wrote:
> I'm trying to extract the domain in the following string. Why doesn't my
> pattern (patt) work:
>
redata
> 'Tue Jan 14 00:43:21 2020::eax...@gstwyysnbd.gov::1578951801-6-10 Sat Jul
> 31 15:17:39 1993::rz...@wgxvhx.com::744121059-5-6 Mon Sep 21 20:22:37
> 1987::ttw..
Nathan wrote:
> I'm using Tkinter for a GUI for a program of mine, and I'm trying to
> use radio buttons to select different functions, but it's not working
> right at all. Originally, I had something like
>
> class ClassOne(self):
You didn't run that code.
> def ___str___(self):
>
Christian Witts wrote:
> On 2012/04/12 06:42 AM, john moore wrote:
>> Hello Pyhton World,
>>
>> I'm new at this and was wondering how I create a number of user specified
>> lists?
>>
>> Example:
>>
>> "How many list would you like to create?"
>> User inputs 5
>> creates five lists,
>> list1 []
>>
Pierre Barthelemy wrote:
> I have a question about event handling and the use of the connect
> function. I have a data object, that contains a series of signals, one
> being "new_data_point" .
>
> When i want to plot the data, i also connect the "new_data_point" event to
> the function "analysis_
Tom Tucker wrote:
> Hello all. Any suggestions how I could easily iterate over a list and
> print the output 3 across (when possible)? One method I was considering
> was removing the recently printed item from the list, checking list
> length,
> etc. Based on the remaining length of the list I
Tino Dai wrote:
> Hi!
>
> I have a question about style. In PEP-8, it says don't exceed 79
> characters, but can this rule ever be trumped by
> readability?
>
> Eg.
>
>
> if someobject.filter(something) \
> .filter(somethingreallyreallyreallyreallylong ==
> somethingelserea
Russel Winder wrote:
> On Thu, 2012-04-19 at 16:00 +0200, Peter Otten wrote:
> [...]
>> Seriously, learn that you don't need backslashes if you put the
>> expression into parens, precalculate parts of the expression and put them
>> into temporary variables -- and if
Chris Hare wrote:
> I have four images in a frame. I want to pop up a menu when the user
> right clicks on an image, and when they choose an option from the menu,
> execute the action.
>
> I can create the popup menu, and bind it to the image. However, what I
> can't figure out is how to detect
goog cheng wrote:
> Hi, I got this problem :
>
> #!python
> # -*- coding: utf-8 -*-
> import re
>
> p = re.compile(ur'\bc123\b')
> print '**',p.search('no class c123 at all').group()
>
> p = re.compile(ur'\b\u7a0b\u6770\b')
> print ur'\u7a0b\u6770'
> print '',p.search(' 程杰 abc'.decode('utf
Jacob Bender wrote:
> Dear tutors,
>
> I'm trying to create a neural network program. Each neuron is in a
> dictionary and each of its connections and their strengths are in a nested
> dictionary. So {0:{1:4, 2:5}}, 1:{0:6}, 2:{1:2}} would mean that neuron 0
> is connected to neuron 1 with a stre
Rogelio wrote:
> If I want to write this command to a file, would this be the right format?
>
> *
> import subprocess
>
> (all my variables defined okay)
>
> perl_script=subprocess.call(['perl',perl_prog,ipfile,cmd,user,timeout,])
>
> log=open('/tmp/pythonOutput
Chris Hare wrote:
> Hello Everyone:
>
> Here is what I am trying to do:
>
> I have a window which has a row of buttons on it. Below the buttons is a
> label frame. Depending upon which button they push, I want to change the
> widgets in the label frame. I can add widgets now with no problem.
Joel Goldstick wrote:
> import os
> def pre_process():
> if os.path.isfile('revelex.csv'):
> os.rename('revelex.csv', 'revelex.tmp')
> print "Renamed ok"
> else:
> print "Exiting, no revelex.csv file available"
> exit()
> out_file = open('revelex.csv', '
Alan Gauld wrote:
> On 23/05/12 17:11, Khalid Al-Ghamdi wrote:
>
>> I'm using Python 3 and have read that you need sqlite to be installed to
>> use the sqlite3 module, but when it is imported it seems to work ok.
>
> The info is wrong.
> Unlike other SQL databases SQLite is not a server based sy
Jason Barrett wrote:
> In python, why does 17/-10= -2? Shouldn't it be -1?
http://docs.python.org/faq/programming.html#why-does-22-10-return-3
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.or
Jason Barrett wrote:
[Jason, please use "reply all" instead of sending a private mail. Your
answer will then appear on the mailing list and other readers get a chance
to offer an alternative explanation.]
>> In python, why does 17/-10= -2? Shouldn't it be -1?
>
>> http://docs.python.org/faq/pr
Bod Soutar wrote:
> Hi,
>
> I am having some difficulty calling a class method from a different class.
> When I run the attached script like this "python cheatsheet.py --list"
>
> C:\>python cheatsheet.py --list
> done
> here?
> Traceback (most recent call last):
> File "cheatsheet.py", line 1
Sean Carolan wrote:
>> Thank you, this is helpful. Minidom is confusing, even the
>> documentation confirms this:
>> "The name of the functions are perhaps misleading"
>>
>>> But I'd start with the etree tutorial (of which
>>> there are many variations on the web):
>
> Ok, so I read through
Flynn, Stephen (L & P - IT) wrote:
> Tutors,
>
> Whilst having a play around with reading in textfiles and reformatting
> them I tried to write a python 3.2 script to read a CSV file, looking for
> any records which were short (indicating that the data may well contain an
> embedded CR/LF. I've a
Mike Nickey wrote:
> What I have is this:
> firstList = ['a', 'b', 'c']
> secondList = [1,2,3]
> thirdList = [1.20, 1.23, 2.54]
>
> What I am looking for is something like this for output:
> {'a': [1, 1.20], 'b': [2, 1.23], 'c': [3, 2.54]}
To get this combine second and third into the list of va
M Nickey wrote:
> Hey all,
>
> I'm trying to recreate the 'help' on various modules that are available.
> So far, I have a bit of code and it seems to be working for the most part.
> I can get the modules available but I also want to be able to print the
> information that is available for each m
Leam Hall wrote:
> Note that this is for an on-line class so I'd appreciate pointers to
> what I need to read or think about more than the answer out right.
>
> Using Python 3 on Linux, is there a way to get the name of a widget
> instead of numeric representations in event.widget?
>
> What I tr
Mark Lawrence wrote:
> On 29/07/2012 00:53, Alan Gauld wrote:
>> On 29/07/12 00:12, Francesco Loffredo wrote:
>>
>>> Every time this happens, I have to admit that I'm a newbie and I've
>>> still got a lot to learn about Python. Especially about its wonderful
>>> standard library.
>>
>> Don't worry
eryksun wrote:
> On Sun, Jul 29, 2012 at 7:21 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> If you don't have to deal with large datasets many of its functions can
>> easily be emulated with lists and loops though. As an example here's the
>> group
Khalid Al-Ghamdi wrote:
> I am a teacher at an industrial training center. We have to conduct
> hands-on exams (fixing pumps, etc). I review all the test schedules for
> all the students (made by other teachers) to make sure there are no
> clashes due to lack of ample supply of equipment or tools.
Alonzo Quijote wrote:
> Is there a way to define a function which takes
>a list (of lists),
>a position specified by a list of integers [i0,i1,...,in], and
>a value
> and returns the result of setting
> list[i0][i1]...[in]=value
>
> The following function works for positions up to
richard kappler wrote:
> Starting to work through "Programming Computer Vision with Python" in my
> -summer of learning python- quest. As I read through the intro to the PIL
> library, I came across the below code. When I read it, I said to my self
> "I don't see how that calls a set of files, t
Brian Carpio wrote:
> Hi,
>
> Hopefully I am allowed to ask this here. I am pretty new to python I've
> only been writing code for about 6 months now strictly for system
> administration purposes; however I have now decided to write something
> "real" that others might benefit from but I am looki
Santosh Kumar wrote:
> Hello there,
>
> I have a few scripts that I made to experiment with, I have to import
> them everytime I enter the Python shell. The scripts are in
> `/home/username/workshop/` (this directory has also some non .py
> files) directory. Is there a way I can import them as so
Dane Saltzman wrote:
> I'm new to python and I was wondering if you could tell me how I would:
>
> first, define a function,distance_from_zero, with one parameter (choose
> any parameter name you like). Second, have that function do the following:
> 1. Check the type of the input it receives.
>
Brad Dutton wrote:
> I recently discovered how to read from a file but I've having some trouble
> with it. I made a short example program that goes like this:
>
>
>1. fob = open('c:/python27/a.txt', 'r')
>2.
>3. print fob.read()
>4. print fob.read()
>
> When it runs it returns t
Gregory Lund wrote:
[For improved readability please avoid # prefixes for the parts of your post
that are not comments in snippets of python code]
> neophyte .py/pyTutor user.
Welcome.
> I am also a university GIS lecturer. My students submit their lab
> assignments (zipped up into one zipfile
Gregory Lund wrote:
> Not too sure on protocol either, sorry if this email is out of line.
You have to hit [Reply all] in your email client for your answer to go to
the list instead of just me.
When you answer a post put your reply after the relevant part of the quoted
post (don't "top-post").
leon zaat wrote:
> Hello everyone,
>
> Can anybody help me with this problem.
> Ik have a program that i' am modifying.
>
> Ik build a function to export data to a csv file. I tried the functions
> over different parts, that needed to be extracted. The parts on it self
> worked fine. Now I put a
Richard D. Moores wrote:
> f = open("factors.txt", 'rb')
> data = pickle.load(f)
> f.close
f.close looks up the close method but doesn't invoke it; you need f.close().
Alternatively use a with statement:
with open("factors.txt", "rb") as f:
data = pickle.load(f)
This will close the file eve
leon zaat wrote:
> I get the error:
> UnicodeDecodeError: 'ascii' codecs can't decode byte 0xc3 in position 7:
> ordinal not in range(128) for the openbareruimtenaam=u'' +
> (openbareruimtenaam1.encode(chartype)) line.
The error message means that database.select() returns a byte string.
bytest
Mazhar Hussain wrote:
> Im new to python and theres something thats bothering me for quite a
> time. I read in 'Learning Python' by Mark Lutz that when we use a
> 'from' statement to import a name present in a module, it first
> imports the module then assigns a new name to it(i.e. the name of the
Mazhar Hussain wrote:
> thanks alot for the help, was really confused with this.
> Well what ure
> trying to say is that even when a module object is deleted from the
> global namespace of a module, a reference of it is still present in
> the sys.modules dict?
Yes, adding the reference to the
Ray Jones wrote:
> The code:
>
> curDir = os.getcwd()
> znDir = shutil.abspath('../')
> baseDir = shutil.abspath('../../')
>
> Files = glob.iglob(os.path.join(znDir, '*'))
> print Files
>
> for moveFile in Files:
> print moveFile
> shutil.move(moveFile, curDir)
>
> Nothing
Pete O'Connell wrote:
> Hi I am trying to parse a text file and create a list of all the lines
> that don't include: "vn", "vt" or are empty. I want to make this as
> fast as possible because I will be parsing many files each containing
> thousands of lines. I though I would give list comprehensio
Pete O'Connell wrote:
[Please don't to-post. Clip all text of previous posts except the portion
relevant to your question]
> Hi. The next step for me to parse the file as I want to is to change
> lines that look like this:
> f 21/21/21 22/22/22 24/24/23 23/23/24
> into lines that look like this:
Cecilia Chavana-Bryant wrote:
> Hola,
>
> I'm going through the 'Command line crash course' by Zed Shaw, thanks to
> the people that recommended this book, its quite a good course, I can see
> what the author was going for with the title but if it wasn't for your
> recommendations, it would have
Victoria Homsy wrote:
> Sorry to bother you with a beginner's problem again...
This is the place for beginners.
> I have tried to write a program that can check if a string is a
> palindrome. My code is as follows:
>
>
> def isPalindrome(s):
> if len(s) <= 1: return True
> else: retur
Flynn, Stephen (L & P - IT) wrote:
> Python 3.2, as in the subject, although I also have 2.7 on this machine
> too.
>
>
>
> I have some data which contains text separated with field delimiters
> (|~) and a record terminator (||)
>
> 12345600990|~5229|~990|~0|~4|~1|~2006-09-08|~13:2
Pete O'Connell wrote:
> Hi, I have tried to simplify things and am running into a bit of trouble.
> What i am really trying to do is: Keep all the lines starting with "v "
> and then delete those lines whose modulus 5 don't equal zero
>
> I have written it like this which seems to take a really l
Norman Khine wrote:
> I have this code (http://pastie.org/4575790) which pulls data from a list
> and then modifies some of the values such as the 'yield' entry, which has
> entries like:
>
> 21
> 15
> ≤ 1000
> ≤ 20
> 2.2 - 30
>
> so that they are cleaned up.
> can the code be improved furth
Jared Nielsen wrote:
> I implemented eryksun's suggestion and used the replace() method.
> But, playing around with it, what I discovered is that it won't store the
> change.
> For example, when the input text is, "Ham and cheese or chicken and
> waffles":
>
> #!/usr/bin/python
>
> text = raw_in
aklei...@sonic.net wrote:
> Part of a previous post:
> """
> Here's the style I'd use:
>
> combos = {
> 0: 'id',
> 2: 'country',
> 3: 'type',
> 5: 'lat',
> 6: 'lon',
> 12: 'name',
> }
>
> Put each entry on its own line, indented by two spaces, and leave a
> trailing comma on the last
Timo wrote:
> Op 28-08-12 10:06, Richard D. Moores schreef:
>> On Tue, Aug 28, 2012 at 12:13 AM, Jerry Zhang
>> wrote:
>>>
>>> 2012/8/28 Richard D. Moores
>>>
On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett
wrote:
> something like:
>
> def _validate_int(obj):
>
Richard D. Moores wrote:
> On Tue, Aug 28, 2012 at 1:21 AM, Timo wrote:
>> Op 28-08-12 10:06, Richard D. Moores schreef:
>
>>> What if I wanted 3., 1234., etc. to be considered ints, as they are by
>>> _validate_int() ?
>>
>>
> isinstance(3., (int, float))
>> True
>>
>> Because 3. is a floa
eryksun wrote:
> On Tue, Aug 28, 2012 at 6:00 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> Anyway here's an alternative implementation:
>>
>>>>> def vi(x):
>> ... if not isinstance(x, numbers.Number):
>> ..
Ray Jones wrote:
> I'm working on another Python replacement for a Bash script, and I ran
> into a need for enhanced time zone functions. Following directions I
> found on a web site, I did the following:
>
> # easy_install --upgrade pytz
> Searching for pytz
> Reading http://pypi.python.org/simp
Ray Jones wrote:
> On 08/28/2012 11:06 AM, Peter Otten wrote:
>> Ray Jones wrote:
>>
>>> I'm working on another Python replacement for a Bash script, and I ran
>>> into a need for enhanced time zone functions. Following directions I
>&g
Steven D'Aprano wrote:
> On 28/08/12 20:00, Peter Otten wrote:
> [...]
>> The differences to _validate_int() are subtle:
>>
>>>>> class S(str):
>> ... def __eq__(self, other): return True
>> ... def __ne__(self, other): return Fals
Steven D'Aprano wrote:
> On 28/08/12 19:02, Peter Otten wrote:
>> Personally, I'm a big fan of ducktyping, so I would probably remove the
>> check completely and live with the consequences:
>>
>>>>> >>> pyprimes._validate_int = lambda
Bala subramanian wrote:
> I use the following way to check for the input parameters. I would
> like to know if there is a any better way to show or describe the
> script usage. So when the user just runs it without any input params.,
> the program shd not execute but just shows the documentation.
Steven D'Aprano wrote:
> On 02/09/12 17:09, Ray Jones wrote:
>
>> But didn't I read somewhere that you can reset an iterator to go through
>> the whole process again?
>
> In general, no.
>
> The usual way to "reset" an iterator is to re-create it.
>
>
> walker = os.walk("/home/steve/start")
>
Albert-Jan Roskam wrote:
> If I implement __len__ in my own class, does it really have to return an
> int? Is there no way around this (other than modifying the source code of
> python itself ;-) It would be nice if len(Example(row, col)) would return
> a dictionary, or a two-tuple (see code below
Ray Jones wrote:
> I have directory names that contain Russian characters, Romanian
> characters, French characters, et al. When I search for a file using
> glob.glob(), I end up with stuff like \x93\x8c\xd1 in place of the
> directory names. I thought simply identifying them as Unicode would
> cl
Ray Jones wrote:
>> You can work around that by specifying the appropriate encoding
>> explicitly:
>>
>> $ python tmp2.py iso-8859-5 | cat
>> �
>> $ python tmp2.py latin1 | cat
>> Traceback (most recent call last):
>>File "tmp2.py", line 4, in
>>print u"Я".encode(encoding)
>> UnicodeEncodeError:
Ray Jones wrote:
> On 09/05/2012 04:52 AM, Peter Otten wrote:
>> Ray Jones wrote:
>>
>>>
>>> But doesn't that entail knowing in advance which encoding you will be
>>> working with? How would you automate the process while reading existing
>>&
staticsafe wrote:
> Hello,
>
> I am running Python 2.6.6 on a Debian Squeeze system. I am using two
> modules in this bit of code - datetime and python-tvrage (available on
> pypy here: http://pypi.python.org/pypi/python-tvrage/).
>
> My goal is to find the time remaining until a certain show ai
damjan kuzmic wrote:
> i would like to know how to write a formula that in excell looks like
> this:
>
> A / EXP(-LN(2) * t)
>>> import math
>>> A = 1.23
>>> t = 4.56
Literally (math.log is the natural logarithm):
>>> A / math.exp(-math.log(2) * t)
29.013618196288864
However,
exp(-x) == 1
john wrote:
> print "hello world" #this is just something to say
/Users/jonathan/Documents/hello.py
> File "", line 1
> /Users/jonathan/Documents/hello.py
> ^
> SyntaxError: invalid syntax
>
> what am i doing wrong?
The >>> prompt indicates that you have already started the inter
Ray Jones wrote:
> I have a multiple 'if' expression that I need to drastically reduce in
> size, both for readability and to keep errors from creeping in.
>
> For example, I would like to have the variable 'test' point to the a
> location 'grid[rcount-1][ccount-1]' so that everywhere I would use
questions anon wrote:
> Hello All, it has been a few months since I have used this and I have only
> just realised I am having problems with leap years. each time I get to
> February of a leap year my program stops,
Does it throw an exception (if so, post the traceback) or does it just
terminat
leam hall wrote:
> I'm in the O'Reilly Python 2 class, so pointers to learning would be
> better than just answers, please. My brain is a bit slow but needs to go
> forward.
>
> Line 16 calls line 31. Rather, it is supposed to. I'm trying to figure out
> why I get
>
> File "./ch8_project.py",
Bala subramanian wrote:
> Thank you all for the answer. Below, i have pasted a sample code that
> shows what i am intending to do. The code fails at line 13 as numpy
> array dnt have a index attribute.
>
> 1 #!/usr/bin/env python
> 2 import numpy as np
> 3
> 4 a=np.array([1,2,3,4,5,6,7,8,
Ray Jones wrote:
> source = source.remove('')
list.remove() modifies the list in-place and therefore by convention returns
None:
>>> source = ["one", "", "three"]
>>> source.remove("")
>>> source
['one', 'three']
___
Tutor maillist - Tutor
Scurvy Scott wrote:
> Hello again python tutor list.
> I have what I see as a somewhat complicated problem which I have no idea
> where to begin. I'm hoping you fine folks can help me.
>
> I'm trying to generate a list of every possible 16 character string
> containing only 2-7 and a-z lowercase.
Scurvy Scott wrote:
> Actually the loop would run 2^80 times
Remember the previous thread? This means the loop will not terminate in the
next few million years.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
htt
Johny Rei wrote:
> Help out there folks,,.I'm completely lost on how to make a program where
> you set a length given in meters and then compute and write out the
> corresponding length measured in inches,in feet, in yards, and in
> miles.Can anybody guide me here, By the example you may provide
Johny Rei wrote:
[Please hit replay-all when you answer posts on this mailing list; that way
everyone on the list can see your post]
> Yes Sir, thank you sir,
You're welcome. Note that we're OK with a less formal tone over here ;)
> I do understand how this works, these is the printf formatt
Alok Joshi wrote:
> I am using Python 3.x
>
> I am unable to remove the border in a Canvas widget with bd=0 or
> borderwidth=0. Can someone please explain how one can do this?
>
> I give below my program
>
> class Avatar(Frame):
> def
>
__init__(self,parent=None,width=100,height=100,ovalness=1
Gregory Lund wrote:
> I teach at a college and I'm trying to use Python (2.6 because I'm
> running my tool in ArcGIS) to unzip a .zip file that contains one
> folder full of student folders, each with 1 or more submissions
> (zipfiles) that represent student submissions to weekly lab
> assignments
Gregory Lund wrote:
>> Using Peter's code, if you create a plain text file called
>> "unzip_twice.py" containing:
>>
>>
>> import glob
>> import os
>> import sys
>> import zipfile
>>
>> source_file = sys.argv[1]
>> dest_folder = sys.argv[2]
>>
>> zipfile.ZipFile(source_file).extractall(dest_folder
Steven D'Aprano wrote:
> That's what we're here for! Don't be shy about asking questions.
Indeed. Also, Gregory, don't expect anything to work directly. Programming
is mostly an iterative process where you write just a little bit of code
before you have to stop to fix a host of bugs. Repeat unt
Albert-Jan Roskam wrote:
> I want to repeatedly search a list to test whether that list contains a
> given element X. Of course, I can use membership testing using "in"
> (list._contains__). But how is this method implemented? It seems to just
> walk through the whole list from beginning to end (s
Ara Kooser wrote:
> Morning,
>
> I dug out some old code from 5 years ago to clean up and get in working
> order. It's a simple agent based model. I have class called Ant which
> contains all the ant-like functions.
>
> I have a list that tracks the ants but I did this is a very crude way. I
>
Albert-Jan Roskam wrote:
> Hi,
>
> My company just started application whitelisting. Now a new version of a
> (benign!!) dll does not work as it (or rather, its file hash, if I
> understood it correctly) is not whitelisted. Is there any way I can use
> the same dll of a newer version? I know this
Leo Degon wrote:
> I'm trying to create a class where the main focus is creating a list whose
> elements are lists and the elements of those lists are collection of zeros
> and ones. I am trying to create functions to rotate the list ninety
> degrees, to reflect it. Having a few problems with the
Matthew Ngaha wrote:
> i have an assignment from a book to practice implementing relative
> imports. it gave a very clear and easy to follow explanation, but my
> results are proving the instructions are wrong. here's what i have
> tried. my folder structure:
>
> Project /
>
>__init__.py
>
Matthew Ngaha wrote:
>> You probably have a path that reaches into Domestic or Europe
>> sub-package. That can happen if e. g. Project/Domestic/Europe is your
>> current working directory.
>>
>> Try to cd into the Project folder's parent directory and see if
>>
>> $ python -c 'import Project.Domes
Albert-Jan Roskam wrote:
> Hi Pythonistas,
>
> I have three classes, Generic, Test and Test2. Generic contains a load
> method that loads a file. This may only be done once, as a file_read_open
> error is returned if the file is open already and an attempt is made to
> re-open it. The file may be
Gregory Lund wrote:
> if item.endswith('.zip'):
> # Combine the base folder name with the subpath to the zip file
> fullpath = os.path.join(outDir, item)
> x = zipfile.ZipFile(fullpath,'a')
Why did you change file mode to "a"?
> x.extractall()
> x.clos
Chris Smith wrote:
> I'm wondering if anyone has seen or knows of a good way to do a lazily
> decorated sort. I was reading about how good the DSU (decorate, sort,
> undecorate) approach is but the problem that we are running into in
> SymPy is that we want to get by with a fast hash sort if possi
eryksun wrote:
> On Fri, Sep 28, 2012 at 8:17 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> def make_key(keys):
>> @total_ordering
>> class Key(object):
>> def __init__(self, value):
>> self._keys = keys(value)
>
Katya Stolpovskaya wrote:
> I have this error:
>
from sys import *
maxint
> Traceback (most recent call last):
> File "", line 1, in
> maxint
> NameError: name 'maxint' is not defined
>
>
> What does it mean and how to deal with it?
You are probably using Python 3 which doesn't have
Albert-Jan Roskam wrote:
> I have a program that reads and writes files using ctypes. When I want it
> to read AND write (e.g. read a file, select some stuff and write that),
> the library returns a 'read-open' error. I think that the pointer to the
> file handle for read and write point to the sa
Malcolm Newsome wrote:
> Hello all,
>
> I looked at map() tonight. I think I have a decent understanding now of
> "how" it works. However, I'm wondering when it is most commonly used in
> the real world and if you could provide some examples (I like to do a
> lot of web stuff...it that helps wi
301 - 400 of 1325 matches
Mail list logo