On Mon, 2009-08-24 at 10:35 -0400, Ronn Ross wrote:
> I need to read a binary file. When I open it up in a text editor it is
> just junk. Does Python have a class to help with this?
Yes, the "file" class.
>>> myfile = open('/path/to/binary/file', 'rb')
-a
--
http://mail.python.org/mailman/li
On Sun, 2009-08-23 at 12:54 -0700, Peng Yu wrote:
> I understand that the sames things can be done with both language.
>
> But I do think that certain applications can be done faster (in term
> of the coding & debugging time, I don't care runtime here) with one
> language than with another.
Yes
On Sun, 2009-08-23 at 13:13 -0700, David Prager Branner wrote:
> I use Chinese and therefore Unicode very heavily, and so Python 3 is
> an unavoidable choice for me. But I'm frustrated by the fact that
> Django, Pylons, and TurboGears do not support Python 3 yet and
> (according to their developmen
On Sun, 2009-08-23 at 16:36 +0100, MRAB wrote:
> Victor Subervi wrote:
> > Hi;
> > I have the following:
> >
> > style = raw_input('What style is this? (1 = short, 2 = long): ')
> > flag = 0
> > while flag == 0:
> > if (style != 1) or (style != 2):
> > style = raw_input('There was a mistake.
On Sun, 2009-08-23 at 05:37 -0700, Peng Yu wrote:
> Hi,
>
> According to http://www.python.org/doc/essays/comparisons.html, it
> says
>
> "Python and Perl come from a similar background (Unix scripting, which
> both have long outgrown), and sport many similar features, but have a
> different phil
On Fri, 2009-08-21 at 18:15 -0700, SeanMon wrote:
> Is there a way to decompress a large (2GB) gzipped file being
> retrieved over FTP on the fly?
>
> I'm using ftplib.FTP to open a connection to a remote server, and I
> have had no success connecting retrbinary to gzip without using an
> intermed
On Sat, 2009-08-22 at 01:17 -0700, flagmino wrote:
[...]
> I am trying to debug:
> I press shift-F9 and F7. I end up in the interpreter where I enter s2
> (1, 2).
>
> >From that point if I press F7, the program restart all over.
> If I press Enter, the program gets out of debug mode.
Umm.. which
Why do you post the same question twice within 5 minutes of each other?
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2009-08-21 at 15:21 -0700, seanm wrote:
> In the book I am using, they give the following function as an
> example:
>
> def copyFile(oldFile, newFile):
> f1 = open(oldFile, 'r')
> f2 = open(newFile, 'w')
> while True:
> text = f1.read(50)
> if text == "":
>
On Tue, 2009-08-18 at 16:16 -0700, WilsonOfCanada wrote:
> Hellos,
>
> I know that if you have:
>
> happy = r"C:\moo"
> print happy
>
> you get C:\moo instead of C:\\moo
>
> The thing is that I want to do this a variable instead.
>
> ex. testline = fileName.readline()
> rawtestline = r t
On Tue, 2009-08-18 at 08:46 +0200, Diez B. Roggisch wrote:
<هاني الموصلي schrieb:
> > Please could you lead me to a way or a good IDE that makes developing
> > huge projects in python more easier than what i found.Now i am using
> > eclips. Actually it is very hard to remember all my classes metho
On Thu, 2009-08-13 at 15:28 -0400, Esmail wrote:
> Hi all,
>
> Essentially all I want to know the size of a directory, and the size
> of a zipped tarball so that I can compute/report the compression ratio.
>
> The code I have seems hideous, but it seems to work. Surely there is an
> easier,more e
On Wed, 2009-08-12 at 11:29 +0200, fakhar Gillani wrote:
>
> Hi,
>
> I am a begineer in Python. Actually I am encoding video files with
> different bitrates using ffmpeg CLI. I wanted to ask you that how can
> I make loops so that I can vary the bitrates in the CLI of ffmpeg??
>
> I want to b
On Fri, 2009-08-07 at 16:50 +, kj wrote:
>
> Conditional imports make sense to me, as in the following example:
>
> def foobar(filename):
> if os.path.splitext(filename)[1] == '.gz':
> import gzip
> f = gzip.open(filename)
> else:
> f = file(filename)
> # e
On Fri, 2009-08-07 at 16:50 +, kj wrote:
>
> Conditional imports make sense to me, as in the following example:
>
> def foobar(filename):
> if os.path.splitext(filename)[1] == '.gz':
> import gzip
> f = gzip.open(filename)
> else:
> f = file(filename)
> # e
On Thu, 2009-08-06 at 09:14 -0700, Robert Dailey wrote:
> Hello,
>
> I'm loading a file via open() in Python 3.1 and I'm getting the
> following error when I try to print the contents of the file that I
> obtained through a call to read():
>
> UnicodeEncodeError: 'charmap' codec can't encode char
On Wed, 2009-08-05 at 20:48 +0530, Rustom Mody wrote:
> When I direct urlopen to a non-existent server process I get
>
> IOError: [Errno socket error] (10061, 'Connection refused')
> The connection refused is as expected but whats the 10061?
> strerror(10061) says 'unknown error'
>
> So its like
On Mon, 2009-08-03 at 19:59 +, kj wrote:
>
> I want to write a decorator that, among other things, returns a
> function that has one additional keyword parameter, say foo=None.
>
> When I try
>
> def my_decorator(f):
> # blah, blah
> def wrapper(*p, foo=None, **kw):
> x = f(*
On Fri, 2009-07-31 at 13:11 -0700, James Stroud wrote:
> Python 2.5:
>
> mbi136-176 211% python
> *** Pasting of code with ">>>" or "..." has been enabled.
>
> ## ipython
On Mon, 2009-07-20 at 13:38 -0700, mrstevegross wrote:
> I know how to use pydoc from the command line. However, because of
> complicated environmental setup, it would be preferable to run it
> within a python script as a native API call. That is, my python runner
> looks a bit like this:
>
> im
On Fri, 2009-07-17 at 21:42 -0400, Ronn Ross wrote:
> How do you define a global variable in a class.
I bit of a mix-up with words here. A variable can be a class variable
or a global variable (wrt the module).. not both.
> I tried this with do success:
> class ClassName:
> global_var = 1
>
On Fri, 2009-07-17 at 10:28 -0700, Phil wrote:
> I'm really new to Python and I am absolutely stumped trying to figure
> this out. I have searched plenty, but I am either searching for the
> wrong keywords or this isn't possible.
>
> What I want to do is have one import be global for the entire pa
On Fri, 2009-06-26 at 21:10 -0700, Horace Blegg wrote:
> Hi, I'm having a hard time deciding which set of PGSQL python bindings
> to go with. I don't know much about SQL to begin with, so the collage
> of packages of somewhat daunting. I'm starting a pet project in order
> to teach my self more, bu
On Fri, 2009-06-12 at 04:51 -0700, khem...@gmail.com wrote:
> Hi.
> As the subject says, I'm a newbie trying to learn python and now
> dictionaries. I can create a dict, understand it and use it for simple
> tasks. But the thing is that I don't really get the point on how to
> use these in real lif
On Sun, 2009-04-12 at 04:00 +, John O'Hagan wrote:
> Hi,
>
> I was getting some surprising false positives as a result of not expecting
> this:
>
> all(element in item for item in iterable)
>
> to return True when 'iterable' is empty.
>
> I guess it goes into hairy Boolean territory tryin
On Wed, 2009-04-08 at 23:51 +0200, Emma Li wrote:
> Hello,
>
> I'm trying to do compression/decompression of stuff with zlib, and I
> just don't get it...
> Here is an example. I assume that dec should be "a", but it isn't. dec
> turns out to be an empty string, and I don't understand why...
>
On Wed, 2009-04-08 at 19:47 +0100, Dale Amon wrote:
> There are a number of things which I have been used
> to doing in other OO languages which I have not yet
> figured out how to do in Python, the most important
> of which is passing method names as args and inserting
> them into method calls. He
On Wed, 2009-04-08 at 12:01 +0200, Peter Otten wrote:
> Gilles Ganault wrote:
>
> > I'd like to go through a list of e-mail addresses, and extract those
> > that belong to well-known ISP's. For some reason I can't figure out,
> > Python shows the whole list instead of just e-mails that match:
> >
On Tue, 2009-04-07 at 07:53 -0400, Dave Angel wrote:
> >
> subprocess.Popen() is expecting the name of a program, which should
> normally have an extension of .exe You're handing it a .bat file,
> which is not executable. It only executes in the context of a command
> interpreter (shell),
On Sat, 2009-04-04 at 15:48 +0200, Hrvoje Niksic wrote:
> Sreejith K writes:
>
> > Python's statvfs module contains the following indexes to use with
> > os.statvfs() that contains the specified information
> >
> > statvfs.F_BSIZE
> > Preferred file system block size.
> [...]
> > statvfs.F_NA
On Sat, 2009-04-04 at 03:56 -0700, Sreejith K wrote:
> Python's statvfs module contains the following indexes to use with
> os.statvfs() that contains the specified information
>
> statvfs.F_BSIZE
> Preferred file system block size.
>
> statvfs.F_FRSIZE
> Fundamental file system block siz
On Wed, 2009-04-01 at 12:17 -0700, mynthon wrote:
> Hi!
>
> I need help. I don't understand what doc says.
>
> I load module from path testmod/mytest.py using imp.load_source(). My
> code is
>
> import imp
> testmod = imp.load_source('koko', 'testmod/mytest.py)
> print testmod
>
> but i don't u
On Mon, 2009-03-30 at 11:05 -0500, Zach Goscha wrote:
> Hi,
>
> I am trying to call an unbound method (Map.Background) but getting the
> following error:
> TypeError: unbound method background() must be called with Map
> instance as first argument (got nothing instead)
>
> Here is some of the
On Sun, 2009-03-29 at 15:17 +0200, Andrea Francia wrote:
> Do you know/use Unipath?
> Unipath is a OO path manipulation library. It's used, for example, to
> rename, copy, deleting files.
>
> Unfortunately this library is no more available as I reported in [1].
>
> I found a copy of the .egg in
On Sun, 2009-03-29 at 11:35 +0100, taliesin wrote:
> Hi,
>
> I'm probably being very dense so apologies in advance, but I can't find
> any decent documentation for the psycopg module for PostgreSQL interfacing.
>
> Google and Yahoo don't seem to return much for any of the queries I gave
> them an
On Fri, 2009-03-27 at 21:15 -0400, andrew cooke wrote:
[...]
> c.l.python used to be the core of a community built around a language. It
> no longer is. It is a very useful place, where some very helpful and
> knowledgeable people hang out and give advice, but instead of representing
> the full
On Fri, 2009-03-27 at 17:55 -0700, rui.li.s...@gmail.com wrote:
> Hi,
>
> anyone can give a simple example or a link on how to use 'drop' with
> pyqt.
>
> what I'm looking for is drop a file to main widget then program get
> the path\filename
>
> something like: main_widget set to accept 'drop e
On Fri, 2009-03-27 at 10:47 -0700, Aahz wrote:
> In article ,
> andrew cooke wrote:
> >Aahz wrote:
> >>
> >> Excuse me? What decline of this newsgroup?
> >
> >Hmmm. It's hard to respond to this without implicitly criticising others
> >here, which wasn't my point at all. But my personal impress
On Thu, 2009-03-26 at 15:23 -0700, harijay wrote:
> Hi
> I want to run shell scripts of the following kind from inside python
> and for some reason either the os.system or the subprocess.call ways
> are not working for me .
>
> I am calling a fortran command (f2mtz ) with some keyworded input that
On Thu, 2009-03-26 at 15:54 -0400, Albert Hopkins wrote:
[...]
> $ cat test.py
> from random import randint
>
> l = list()
> for i in xrange(8):
> l.append(randint(0,10))
^^^
should have been:
l.append(randint(0,9))
>
> hi
On Thu, 2009-03-26 at 12:22 -0700, paul.scipi...@aps.com wrote:
> Hello,
>
> I'm a newbie to Python. I have a list which contains integers (about
> 80,000). I want to find a quick way to get the numbers that occur in
> the list more than once, and how many times that number is duplicated
> in t
On Thu, 2009-03-26 at 08:36 -0700, Edd Barrett wrote:
> Hi there,
>
> My first post here, so hello :)
>
> Just a little background, I am writing my dissertation, which is a JIT
> compiler based upon LLVM and it's python bindings, along with the
> aperiot LL(1) parser.
>
> I have some code here,
On Wed, 2009-03-25 at 21:26 +, Martin P. Hellwig wrote:
> >
> > PEP 8 recommends the latter.
> >
> >
> > Raymond
> I can't seem to find where this recommendation is mentioned or implied.
Wow, you must not have looked very hard:
1. Point your browser to http://www.python.org/dev/peps/p
Also, instead of caching exceptions you can do lazy lookups kinda like
this:
-
# a.py
class A:
pass
-
# b.py
class B:
On Sun, 2009-03-22 at 15:55 +, Sean wrote:
> Anyone got any thoughts about what to use as a replacement. I need
> something (like bsddb) which uses dictionary syntax to read and write an
> underlying (fast!) btree or similar.
>
gdbm
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 2009-03-21 at 17:41 -0700, Randy Turner wrote:
> Hi,
>
>
> I was reading a book on Python-3 programming recently and the book
> stated that, while there is an __init__ method for initializing
> objects, there was a __del__ method but the __del__ method is not
> guaranteed to be called whe
On Fri, 2009-03-20 at 22:14 -0400, Colin J. Williams wrote:
> Below is a test script:
>
> # tSubProcess.py
>
> import subprocess
> import sys
> try:
>v= subprocess.Popen('ftype
> py=C:\Python25\Python.exe')
> except WindowsError:
>print(sys.exc_info())
>
> Here is the output:
>
> *** P
On Fri, 2009-03-20 at 12:59 -0700, Brendan Miller wrote:
> I have a python application that I want to package up and deploy to
> various people using RHEL 4.
>
> I'm using python 2.6 to develop the app. The RHEL 4 machines have an
> older version of python I'd rather not code against (although tha
On Fri, 2009-03-20 at 07:54 -0700, thomasvang...@gmail.com wrote:
> You could use:
> B=list(set(A)).sort()
> Hope that helps.
Which will assign None to B.
sorted(list(... or B.sort() is probably what you meant.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2009-03-20 at 07:42 -0700, Esmail wrote:
> Hi all,
>
> I've been reading/posting to usenet since the 80s with a variety of
> tools (vn, and most recently Thunderbird) but since my ISP
> (TimeWarner) no longer provides usenet feeds I'm stuck.
>
> I am not crazy about the web interface via
On Fri, 2009-03-20 at 07:16 -0700, Alexzive wrote:
> Hello there,
>
> I'd like to get the same result of set() but getting an indexable
> object.
> How to get this in an efficient way?
>
> Example using set
>
> A = [1, 2, 2 ,2 , 3 ,4]
> B= set(A)
> B = ([1, 2, 3, 4])
>
> B[2]
> TypeError: unin
On Fri, 2009-03-20 at 08:52 +1100, Jervis Whitley wrote:
> On Fri, Mar 20, 2009 at 8:28 AM, Albert Hopkins
> wrote:
> > On Fri, 2009-03-20 at 07:25 +1100, Jervis Whitley wrote:
> >> >
> >> >if stringA.lower() in stringB.lower():
> >> >
On Fri, 2009-03-20 at 07:25 +1100, Jervis Whitley wrote:
> >
> >if stringA.lower() in stringB.lower():
> >bla bla bla
> >
>
> from string import lower
>
> if lower(stringA) in lower(stringB):
> # was this what you were after?
>
This is analogous to standing behind a
On Thu, 2009-03-19 at 11:57 -0500, Jim Garrison wrote:
> Use case: parsing a simple config file line where lines start with a
> keyword and have optional arguments. I want to extract the keyword and
> then pass the rest of the line to a function to process it. An obvious
> use of split(None,1)
>
On Thu, 2009-03-19 at 08:42 -0700, Emanuele D'Arrigo wrote:
> Hi everybody,
>
> I just had a bit of a shiver for something I'm doing often in my code
> but that might be based on a wrong assumption on my part. Take the
> following code:
>
> pattern = "aPattern"
>
> compiledPatterns = [ ]
> compi
On Wed, 2009-03-18 at 16:58 -0700, Mike314 wrote:
> Hello,
>
>I have following code:
>
> def test_func(val):
> print type(val)
>
> test_func(val=('val1'))
> test_func(val=('val1', 'val2'))
>
> The output is quite different:
>
>
>
>
> Why I have string in the first case?
You could h
On Fri, 2009-03-13 at 21:04 +, tinn...@isbd.co.uk wrote:
> What's the neatest way to do the following in case insensitive fashion:-
>
> if stringA in stringB:
> bla bla bla
>
> I know I can just do:-
>
> if stringA.lower() in stringB.lower():
> bla bla bla
>
> But I
On Fri, 2009-03-13 at 21:01 +, tinn...@isbd.co.uk wrote:
> I've had this trouble before, how do I find the details of how "in"
> works in the documentation. E.g. the details of:-
>
> if string in bigstring:
>
> It gets a mention in the "if" section but not a lot.
>
>From http://docs.py
On Thu, 2009-03-12 at 12:57 -0700, IanR wrote:
> I'm processing RSS content from a # of given sources. Most of the
> time the url given by the RSS feed redirects to the real URL (I'm
> guessing they do this for tracking purposes)
>
> For example.
>
> This is a url that I get from and RSS feed,
>
On Thu, 2009-03-12 at 13:25 -0700, Chris Rebert wrote:
> On Thu, Mar 12, 2009 at 1:07 PM, Sam Ettessoc wrote:
> > I would like to share a benchmark I did. The computer used was a
> > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS
> > 10.5.6 and a lots of software running (a t
> > Yep...as documented[1], "even a raw string cannot end in an odd number
> > of backslashes".
>
> So how do you explain this?
>
> >>> r'a\'b'
> "a\\'b"
That doesn't "end in an odd number of backslashes."
Python is __repr__esenting a raw string as a "regular" string.
Literally they
On Sat, 2009-03-07 at 03:07 -0500, Albert Hopkins wrote:
> On Fri, 2009-03-06 at 23:57 -0800, Paul Rubin wrote:
> > alex23 writes:
> > > But _you_ only _just_ stated "It does have some (generally small)
> > > performance ramifications as
> > > well
On Fri, 2009-03-06 at 23:57 -0800, Paul Rubin wrote:
> alex23 writes:
> > But _you_ only _just_ stated "It does have some (generally small)
> > performance ramifications as
> > well" and provided timing examples to show it. Without qualification.
>
> The performance difference can be large if the
On Tue, 2009-03-03 at 13:41 -0600, nuwandame wrote:
> What I am wanting to do is execute code whenever a property of a class
> object has been changed.
>
> i.e.
>
> class test:
>
> testproperty = None
>
>
> bob = test()
> bob.testproperty = 'something'
>
> So, when bob.testproperty is set
On Thu, 2009-02-26 at 13:48 -0800, Jesse Aldridge wrote:
> I have one module called foo.py
> -
> class Foo:
> foo = None
>
> def get_foo():
> return Foo.foo
>
> if __name__ == "__main__":
> import bar
> Foo.foo = "foo"
> bar.go()
> -
> A
On Wed, 2009-02-25 at 17:56 +0530, aditya saurabh wrote:
> I defined two functions - lets say
> fa = lambda x: 2*x
> fb = lambda x: 3*x
> Now I would like to use fa*fb in terms of x
> is there a way?
> Thanks in advance
I'm not sure what "use fa*fb in terms of x" means.
But if you mean fa(x) * fb
On Tue, 2009-02-24 at 11:05 -0800, zaheer.ag...@gmail.com wrote:
> Hi,
>
> Is there any Python equivalent of java jar,can I include all my
> sources,properties file etc into a single file.Is there anyway in
> Python that I can run like the following
>
> java -jar Mytest.jar --startwebserver
>
>
On Mon, 2009-02-23 at 19:22 +, Gary Wood wrote:
> '''exercise to complete and test this function'''
> import string
> def joinStrings(items):
> '''Join all the strings in stringList into one string,
> and return the result. For example:
> >>> print joinStrings(['very', 'hot', 'day']
On Sun, 2009-02-22 at 16:15 -0800, James Pearson wrote:
> I've been using irclib to write a simple irc bot, and I was running
> into some difficulties with pickle. Upon some experimentation with
> pdb, I found that pickle.load() doesn't load *all* of the data the
> _first_ time it's called.
>
> F
On Sun, 2009-02-22 at 12:09 -0800, Ravi wrote:
> I am sorry about the typo mistake, well the code snippets are as:
>
> # Non Working:
>
> class X(object):
> def f(self, **kwds):
> print kwds
> try:
> print kwds['i'] * 2
> except KeyError:
> print "unknown keyword argument"
> s
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote:
> The following code didn't work:
>
> class X(object):
> def f(self, **kwds):
> print kwds
> try:
> print kwds['i'] * 2
> except KeyError:
> print
On Thu, 2009-02-19 at 10:55 -0800, Ron Garret wrote:
> I'm trying to split a CamelCase string into its constituent components.
> This kind of works:
>
> >>> re.split('[a-z][A-Z]', 'fooBarBaz')
> ['fo', 'a', 'az']
>
> but it consumes the boundary characters. To fix this I tried using
> lookahe
On Tue, 2009-02-17 at 19:46 +0530, Deepak Rokade wrote:
>
> Yes I can do that but for that I will have to go through entire list
> of files and also I will have to first get the whole list of files
> present in directory.
>
> In case of my application this list can be huge and so want to list
> t
On Sat, 2009-02-14 at 07:45 -0700, Linuxguy123 wrote:
> Excuse my ignorance, but is there a limit to the size of function names
> in Python ?
>
> I named a function getSynclientVersion() and I got an error when I
> called it.
You forgot to paste the error.
--
http://mail.python.org/mailman/lis
On Wed, 2009-02-11 at 10:35 -0800, jeffg wrote:
> Having issue on Windows cmd.
> > Python.exe
> >>>a = u'\xf0'
> >>>print a
>
> This gives a unicode error.
>
> Works fine in IDLE, PythonWin, and my Macbook but I need to run this
> from a windows batch.
>
> Character should look like this "ð".
>
On Tue, 2009-02-10 at 12:50 -0800, Josh Dukes wrote:
> The thing I don't understand is why a generator that has no iterable
> values is different from an empty list. Why shouldn't bool ==
> has_value?? Technically a list, a tuple, and a string are also objects
> but if they lack values they're eva
On Tue, 2009-02-10 at 11:15 -0800, Josh Dukes wrote:
> quite simply...what???
>
> In [108]: bool([ x for x in range(10) if False ])
> Out[108]: False
>
> In [109]: bool( x for x in range(10) if False )
> Out[109]: True
>
> Why do these two evaluate differently? I was expecting that they would
>
On Sat, 2009-02-07 at 17:12 +, rdmur...@bitdance.com wrote:
> I've googled and looked through os.path, but I don't see a method for
> determining if a path points to a FIFO. Anyone know of a simple way to
> do so?
import os
import stat
st_mode = os.stat(path)[0]
isfifo = stat.S_ISFIFO(st_mod
Probably that [c.l.]python is becoming more popular and, like most
things as they become popular, it loses its "purity"... much like the
Internet in the early 1990s.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2009-02-05 at 10:04 -0800, bearophileh...@lycos.com wrote:
> This comes after a small discussion in another Python newsgroup.
> Haskell supports a where clause, that's syntactic sugar that allows
> you to define things like this:
>
> p = a / b
> where
> a = 20 / len(c)
> b = foo(
On Wed, 2009-02-04 at 13:40 +0200, Noam Aigerman wrote:
> Hi All,
> I have a script in which I receive a list of functions. I iterate over
> the list and run each function. This functions are created by some other
> user who is using the lib I wrote. Now, there are some cases in which
> the functio
On Wed, 2009-01-14 at 16:58 +1000, James Mills wrote:
[...]
> Still I would avoid using this idiom altogether
> and jsut stick with default values. For Example:
>
> FOO = 1
>
> def f(x=FOO):
>...
>
>
> Use this instead:
>
> def f(x=1):
>...
That only works well when "1" is only used o
On Tue, 2009-01-13 at 12:02 -0800, Santiago Romero wrote:
> Hi.
>
> Until now, all my python programs worked with text files. But now I'm
> porting an small old C program I wrote lot of years ago to python and
> I'm having problems with datatypes (I think).
>
> some C code:
>
> fp = fopen( fi
On Tue, 2009-01-13 at 08:59 -0800, bruce wrote:
> Hi..
>
> quite new to python, and have a couple of basic question:
>
> i have
> ("term":["1","2","3"])
>
> as i understand it, this is a list, yes/no?
>
No, that's invalid syntax:
>>> ("term":["1","2","3"])
File "", line 1
On Tue, 2009-01-13 at 16:13 +0100, TP wrote:
> Hi everybody,
>
> Try the following program:
>
>
> def f():
> def f_nested():
> exec "a=2"
> print a
> f()
>
>
> It yields an error.
> $ python nested_exec.py
> File "nested_exec.py", l
On Mon, 2009-01-12 at 19:51 +0100, TP wrote:
> Hi everybody,
>
> I try to modify locals() as an exercise.
> According to the context (function or __main__), it works differently (see
> below). Why? Thanks
>
> Julien
Per the locals() documentation @
http://docs.python.org/library/functions.html
On Sat, 2009-01-10 at 17:12 +, David Shi wrote:
> I am looking for an efficient Python script to download and save
> a .zip file programmatically (from http or https call).
>
> Regards.
>
> David
urllib?
-a
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 2009-01-07 at 16:46 -0600, da...@bag.python.org wrote:
> Can find nothing in the on-line docs or a book.
> Groping in the dark I attempted :
>
> script24
> import io
> io.open('stdprn','w') # accepted
> stdprn.write('hello printer') # fails < stdprn is not defined >
On Tue, 2009-01-06 at 11:23 -0800, rcmn wrote:
> I'm not sure how to call it sorry for the subject description.
>Here what i'm trying to accomplish.
> the script i'm working on, take a submitted list (for line in file)
> and generate thread for it. unfortunately winxp has a limit of 500
> threa
On Tue, 2008-12-30 at 11:31 -0800, wx1...@gmail.com wrote:
> I have a list and would like to parse the list appending each list
> item to the end of a variable on a new line.
>
> for instance
>
> mylist = ['something\n', 'another something\n', 'something again\n']
>
> then parse mylist to make i
On Tue, 2008-12-23 at 13:18 +, Lie Ryan wrote:
> On Tue, 23 Dec 2008 11:50:59 +0100, Qian Xu wrote:
>
> > Hello All,
> >
> > Is it possible to print something to console without a line break?
> >
> > I tried:
> > sys.stdout.write("Testing something ...") // nothing will be printed
> > ti
On Fri, 2008-12-19 at 06:34 -0800, Alex wrote:
> Hi,
>
> I have a Pyhon GUI application that launches subprocess.
> I would like to read the subprocess' stdout as it is being produced
> (show it in GUI), without hanging the GUI.
>
> I guess threading will solve the no-hanging issue, but as far as
On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote:
[...]
> > So is there a way to find the offending code w/o having to go
> through
> > every line of code in 'foo' by hand?
>
> Just search for "del x" in your code. Your editor does have a search
> function, surely?
>
>
Well, you'd th
On Tue, 2008-12-09 at 20:56 +, Lie Ryan wrote:
> Actually I noticed a tendency from open-source projects to have slow
> increment of version number, while proprietary projects usually have
> big
> version numbers.
>
> Linux 2.x: 1991 Python 3.x.x: 1991. Apache 2.0: 1995. OpenOffice.org
> 3.0
Say I have module foo.py:
def a(x):
def b():
x
del x
If I run foo.py under Python 2.4.4 I get:
File "foo.py", line 4
del x
SyntaxError: can not delete variable 'x' referenced in nested
scope
Under Python
I'm looking at a person's code and I see a lot of stuff like this:
def myfunction():
# do some stuff stuff
my_string = function_that_returns_string()
# do some stuff with my_string
del my_string
# do some other stuff
r
On Sat, 2008-12-06 at 04:03 -0800, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'd like to insert Multiple Records Using One Insert Statement
>
> inserting one record using one insert statement works
> this is the example:
>
> import MySQLdb
> conn = MySQLdb.connect(host="localhost",.)
> cursore = co
It's been a while so I can't remember, but it seems like "yield" was
dropped in to python relatively quickly in 2.2. Was there a similar
outrage when "yield" became a keyword?
-a
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2008-12-04 at 20:01 +0100, Дамјан Георгиевски wrote:
> > I don't think it matters. Here's a quick comparison between 2.5 and
> > 3.0 on a relatively small 17 meg file:
> >
> > C:\>c:\Python30\python -m timeit -n 1
> > "open('C:\\work\\temp\\bppd_vsub.csv', 'rb').read()"
> > 1 loops, best
On Wed, 2008-12-03 at 13:38 -0800, Warren DeLano wrote:
> A bottom line / pragmatic question... hopefully not a FAQ.
>
> Why was it necessary to make "as" a reserved keyword?
>
> And more to the point, why was it necessary to prevent developers from
> being able to refer to attributes named "as
101 - 200 of 212 matches
Mail list logo