I have a script running under Python 2.5 that needs to modify files in
place. I want to do this with some level of assurance that I won't lose
data. E.g. this is not safe:
def unsafe_modify(filename):
fp = open(filename, 'r')
data = modify(fp.read())
fp.close()
fp = open(filename,
Ulrich Eckhardt wrote:
> Peter Otten wrote:
>> Examples for classes that don't accept attributes are builtins
>> like int, tuple, and -- obviously -- dict. You can make your own
>> using the __slot__ mechanism:
>>
> class A(object):
>> ... __slots__ = ["x", "y"]
>> ...
> a = A()
>
rzed wrote:
> I've tried to install PySVG in a Python 3 setting, and I get a few
> errors on the build. Most are easy to fix, but this one I can't
> explain or fix:
>
>
> Traceback (most recent call last):
> File "", line 1, in
> File "builders.py", line 12, in
> from pysvg.shape impor
Chris Angelico wrote:
> On Sat, Jun 25, 2011 at 10:25 AM, Ben Finney
> wrote:
>> No. The answer is *still* “why, any exception at all”. The name
>> ‘os.read’ could be re-bound at run-time to any object at all, so a code
>> checker that you “point at any given line of code” can't know what the
>>
John Gordon wrote:
> In
> pipehappy writes:
>
>> Why people want print() instead of print str? That's not a big deal
>> and the old choice is more natural. Anyone has some clue?
>
> Because the new Python uses print(). print "str" is the old way.
I think you missed the point of the question
Jerry Hill wrote:
> I'm curious. Is there a way to get the number of significant digits
> for a particular Decimal instance? I spent a few minutes browsing
> through the docs, and didn't see anything obvious. I was thinking
> about setting the precision dynamically within a function, based on
>
Ahmed, Shakir wrote:
> The problem is happening when it is coming to write option.
>
> The * is not the real name of the zip file, I just hide the name.
Please don't waste our time by showing us fake code that doesn't do what you
say it does.
You said that "The script is here", but that was not