First  |  Prev |  Next  |  Last
Pages: 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
default argument
Hi, Is this grammer working in Python? class test: self._value = 10 def func(self, self._value) When i try it, it complains about undefined self. i don't know why. TIA ... 11 May 2010 17:54
How to make this doctest work?
On 5/11/2010 5:29 AM, Xie&Tian wrote: Hello I ran across this accidentally and wonders how to make the doctest in following code snippet work: import doctest def a(): """ a = '\\r\\n' print a No matter how many blank lines I add here, it just c... 11 May 2010 15:38
documentation bug? (format spec mini language)
The documentation at http://docs.python.org/py3k/library/string.html#format-specification-mini-language '<' Forces the field to be left-aligned within the available space (This is the default.) The conflicting example:: format(3.2,'10.5f') ' 3.20000' format(3.2,'... 12 May 2010 22:31
Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)
On Tue, May 11, 2010 at 10:37 AM, <python(a)bdurham.com> wrote: Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an exception when a string is empty? If you use negative indexes in the slice, they refer to items from the end of the sequence instead of... 11 May 2010 13:22
Slice last char from string without raising exception on emptystring (Re: Extract all words that begin with x)
python(a)bdurham.com ha scritto: Terry, ... word[0:1] does the same thing. All Python programmers should learn to use slicing to extract a char from a string that might be empty. Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an exception... 11 May 2010 12:15
Slice last char from string without raising exception on empty string(Re: Extract all words that begin with x)
Terry, ... word[0:1] does the same thing. All Python programmers should learn to use slicing to extract a char from a string that might be empty. Is there an equivalent way to slice the last char from a string (similar to an .endswith) that doesn't raise an exception when a string is empty? Thanks, Malcol... 11 May 2010 11:08
urllib.urlopen blocking?
Hi, I'm new to python and have been playing around with it for a few days now. So please forgive me if this is a stupid question :) I've tried writing a little application with pygtk and urllib. When a button is clicked I create a new thread that opens an URL with urllib. The new thread is running but as soon ... 11 May 2010 11:08
reading xml from python
On Tue, May 11, 2010 at 5:54 AM, Hvidberg, Martin <mhv(a)dmu.dk> wrote: I'm looking for at way to read (and later write) small simple .xml file from Python. e.g. I would like to read the following from a small ini.xml file into a dictionary. <?xml version="1.0" encoding="UTF-8"?> <initialisati... 11 May 2010 10:02
how to import a module for global use in a library package ?
Aur� Gourrier wrote: [snip] My question is the following: I need to import an external package, say numpy, for use in various submodules. So far, I simply do an import numpy as _numpy where needed, say sub1module1 and sub2module2. This means that I import this package a number of times which doesn't ... 12 May 2010 04:47
unittest basics
is there a way to test that a certian library or module is or can be loaded successfully? self.assert('import blah') -- John Maclean MSc. (DIC) BSc. (Hons) Linux Systems and Applications 07739 171 531 ... 11 May 2010 08:55
First  |  Prev |  Next  |  Last
Pages: 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130