>> In [21]: a = 10.0
>
>> In [22]: b = 10.0 / 3.0
>
>> In [24]: divmod(a, b)[0]
>> Out[24]: 2.0
>
>> In [25]: math.floor(a / b) - 1.0
>> Out[25]: 2.0
>
> Wow. To me this stuff is just black magic, with a bit of voodoo
> added for good measure... Maybe some day I'll understand it.
I think thi
dads wrote:
Sorry forgot to mention I'm using python 2.6
This looks like a homework assignment.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
OldAl wrote:
I am impressed with Bazaar's implementation of plugins: a Python
plugin is simply copied to a ./bazaar/plugin/ directory and
the plugin is recognized by Bazaar and can be run from CLI as:
bzr
I would like to implement something similar in my Finite Element
Method program, so that
Tim Roberts wrote:
"W. eWatson" wrote:
W. eWatson wrote:
A friend is looking for some help with how to use Python to access a
WinTV (Go Plus) capture card, and how to display an image from it. Is
there some facility that might help him, or does anyone have experience
with such use that migh
dads wrote:
When creating a script that converts digits to words I've come across
some unexplainable python. The script works fine until I use a 5 digit
number and get a 'IndexError: string index out of range'. After
looking into it and adding some print calls, it looks like a variable
changes fo
On Sat, 26 Sep 2009 08:54:49 -0700, devilkin wrote:
> I'm just starting learning python, and coding in emacs. I usually
> split emacs window into two, coding in one, and run script in the
> other, which is not very convenient. anyone can help me with it? is
> there any tricks like emacs short cut?
Hacken wrote:
On Sep 25, 6:27 pm, Dave Angel wrote:
Hacken wrote:
I have write some python script
i want to use browser(IE or FF) to call it, an show the returns!
how to?
You don't say much about your environment, nor the nature of your
script. So my response will
dads wrote:
> When creating a script that converts digits to words I've come across
> some unexplainable python. The script works fine until I use a 5 digit
> number and get a 'IndexError: string index out of range'. After
> looking into it and adding some print calls, it looks like a variable
> c
dads 写道:
...
enter number: 34567
_5digit function used
34 before sent to _2digit
34 slice when at _2digit function
34 before sent to plus_ten function
7 slice when at _2digit function
This is the point. _2digit() only gets 1 digit("7") and needs accessing
the second byte in:
var = self.plu
Without reading or trying to understand the program well enough, at the very
outset, looks like it's a program to convert a set of numeric digits into
it's equivalent whole number representation, in textual form, and that while
author of this piece of code has taken care of english numeric nuances
you can use emacs command shell for that
2009/9/26 devilkin
> I'm just starting learning python, and coding in emacs. I usually
> split emacs window into two, coding in one, and run script in the
> other, which is not very convenient. anyone can help me with it? is
> there any tricks like emacs
On Sat, Sep 26, 2009 at 7:37 PM, dads wrote:
> When creating a script that converts digits to words I've come across
> some unexplainable python. The script works fine until I use a 5 digit
> number and get a 'IndexError: string index out of range'.
Please provide the full error traceback. Help u
Sorry forgot to mention I'm using python 2.6
--
http://mail.python.org/mailman/listinfo/python-list
When creating a script that converts digits to words I've come across
some unexplainable python. The script works fine until I use a 5 digit
number and get a 'IndexError: string index out of range'. After
looking into it and adding some print calls, it looks like a variable
changes for no reason. T
On Sat, 26 Sep 2009 19:05:37 -0700, Hacken wrote:
> i just want write my programes in python, and i use Browser to show my
> GUI,
>
> can i do that?and how to?
>
> thanks,waitting..
In Python 2.6, you can use the webbrowser module.
--
Steven
--
http://mail.python.org/mailman/listinfo
On Sep 25, 6:27 pm, Dave Angel wrote:
> Hacken wrote:
> > I have write some python script
>
> > i want to use browser(IE or FF) to call it, an show the returns!
>
> > how to?
>
> You don't say much about your environment, nor the nature of your
> script. So my response will be very generic.
>
> If
I am impressed with Bazaar's implementation of plugins: a Python
plugin is simply copied to a ./bazaar/plugin/ directory and
the plugin is recognized by Bazaar and can be run from CLI as:
bzr
I would like to implement something similar in my Finite Element
Method program, so that any user can wr
Raymond Hettinger:
> Another approach for exiting multiple levels of loops is wrap the
> inner calls in a function and return from them when needed:
>
> def f(x):
> for y in y:
> for z in Z:
> if test1(x,y,z):
> return
> frobnic
tinn...@isbd.co.uk wrote:
>
>My maildir hierarchy is created by mutt which is a *very* standards
>compliant MUA, surely standard python libraries should work with
>standard maildirs not some wierd extension thereof.
The Maildir specification does not allow for subfolders. That was added in
Maildi
"W. eWatson" wrote:
>W. eWatson wrote:
>> A friend is looking for some help with how to use Python to access a
>> WinTV (Go Plus) capture card, and how to display an image from it. Is
>> there some facility that might help him, or does anyone have experience
>> with such use that might suggest
On 2009-09-26 09:32 AM, Peng Yu wrote:
Hi,
I am looking for a method in python that is similar to the function
str() in R, if you are familiar with R,
If you have no idea of R, what I want is to print the class
information of an object and the values of its members. Overloading
'__expr__' and '
On 2009-09-26, Dave Angel wrote:
> Actually even 64k looked pretty good, compared to the 1.5k of
> RAM and 2k of PROM for one of my projects, a navigation system
> for shipboard use.
I've worked on projects as recently as the past year that had
only a couple hundred bytes of RAM, and most of it
You can try flushing, or reopening with no buffering
sys.stdout.flush()
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
On Sun, Sep 27, 2009 at 2:20 AM, Dave Angel wrote:
> kj wrote:
>>
>> Is there any way to specify unbuffered I/O from *within* the code
>> (rather than via the command-line
Jeff McNeil wrote:
> > > My maildir hierarchy is created by mutt which is a *very* standards
> > > compliant MUA, surely standard python libraries should work with
> > > standard maildirs not some wierd extension thereof.
> >
> > > --
> > > Chris Green
> >
> > The doc says that "Folders of the sty
On Sat, Sep 26, 2009 at 8:10 AM, Steven D'Aprano
wrote:
> On Sat, 26 Sep 2009 06:57:52 -0500, Peng Yu wrote:
>
>> Hi,
>>
>> It is strange that the file mode of .pyc files are changed to executable
>> (x mode) after the corresponding .py files have been run.
>
> Are you sure? They don't on my syste
Jeff McNeil wrote:
> > > The Maildir++ spec states that folders need to begin with a period.
> > > The list_folders method enforces that:
> >
> > > def list_folders(self):
> > > """Return a list of folder names."""
> > > result = []
> > > for entry in os.listdir(self._p
waqas ahmad wrote:
Now i want to search all those pages, where i have *NOT* written "#acl
InternationalGroup:read" *But* i have written only "CatInternational"
in the page text.
You can split the two queries into two regexes:
import re
acl = re.compile(r'#acl InternationalGroup:read')
cat =
QOTW: "Forget ethical. We can do his homework for him, we can perhaps pass
exams for him, maybe graduate for him, and then with our luck, he'll get a
job in our office and we get to do his work for him." - Mel
http://groups.google.com/group/comp.lang.python/msg/8f7c1fa393c23476
Wanderer wrote:
> Is there a way to get python to import files that don't end in .py?
How about using imp.load_source?
y...@x:/tmp$ cat out.m
print("this is my module")
# comment
y=[1,2,3,4,5,6,7,8,9];
# comment
y...@x:/tmp$ cat load_my_module.py
import imp
MyModule=imp.load_source('MyModule','ou
I'm just starting learning python, and coding in emacs. I usually
split emacs window into two, coding in one, and run script in the
other, which is not very convenient. anyone can help me with it? is
there any tricks like emacs short cut?
also please recommand some emacs plug-ins for python progra
On 2009-09-26, Dennis Lee Bieber wrote:
> On Fri, 25 Sep 2009 14:22:51 + (UTC), Grant Edwards
> declaimed the following in
> gmane.comp.python.general:
>
>>
>> EXX accomplised much of the context switch operation. I don't
>> remember how much RAM was available, but it wasn't much...
>
> Zilo
Howdy all,
I'm pleased to announce the release of version 1.5.1 of ‘python-daemon’.
What is python-daemon
=
The ‘python-daemon’ library is the reference implementation of PEP 3143
http://www.python.org/dev/peps/pep-3143/>, “Standard daemon process
library”.
The source distri
Hi all.
So, the doc is pitiless:
"Note Functionality within this package requires that the __main__
method be importable by the children. This is covered in Programming
guidelines however it is worth pointing out here. This means that some
examples, such as the multiprocessing.Pool examples wi
On 25 Sep, 05:25 am, jacopo.pe...@gmail.com wrote:
On Sep 24, 7:54�pm, exar...@twistedmatrix.com wrote:
On 07:10 am, jacopo.pe...@gmail.com wrote:
>On Sep 23, 5:57�pm, exar...@twistedmatrix.com wrote:
>[snip]
[snip]
If you have a function that takes 5 minutes to run, then you're
blocking
the
On Sat, 26 Sep 2009 06:57:52 -0500, Peng Yu wrote:
> Hi,
>
> It is strange that the file mode of .pyc files are changed to executable
> (x mode) after the corresponding .py files have been run.
Are you sure? They don't on my system.
[st...@sylar test]$ ls -l
total 8
-rw-rw-r-- 1 steve steve 6
On 25 Sep, 02:26 pm, aaron.watt...@gmail.com wrote:
Hi folks. I just modified the WHIFF concepts index page
http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts
To include the following paragraph with a startling and arrogant
claim in the final sentence :)
"""
Developers build WHIFF app
Is there any way to specify unbuffered I/O from *within* the code
(rather than via the command-line -u flag)?
TIA!
kynn
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 21, 10:59 am, Nobody wrote:
> I have a similar question.
>
> What I want: a tokeniser generator which can take a lex-style grammar (not
> necessarily lex syntax, but a set of token specifications defined by
> REs, BNF, or whatever), generate a DFA, then run the DFA on sequences of
> bytes.
Dennis Lee Bieber wrote:
On Fri, 25 Sep 2009 14:22:51 + (UTC), Grant Edwards
declaimed the following in
gmane.comp.python.general:
EXX accomplised much of the context switch operation. I don't
remember how much RAM was available, but it wasn't much...
Zilog Z80... as wit
Hi,
First of all thanks a lot for your reply. "search.findall" is not working. here
is my complete small program.
def getAcl(request, pg):
pged = PageEditor(request, pg)
pagetext = pged.get_raw_body()
search=re.compile("^#acl InternationalGroup.*\n", re.M).search(pagetext)
i
Hi,
It is strange that the file mode of .pyc files are changed to
executable (x mode) after the corresponding .py files have been run. I
have the follow python, which is compiled from source code by me.
$ python --version
Python 2.6.2
Should .pyc files have the x mode?
Regards,
Peng
--
http://
On Sep 26, 6:33 am, "Gabriel Genellina"
wrote:
>
> So, look in your file for lines ending in %
>
> --
> Gabriel Genellina
Hello All,
I fixed it with your help. Sometimes you need that extra insight from
comp.lang.python.
Thank you so much,
Bahadir
--
http://mail.python.org/mailman/listinfo/p
On Sep 25, 12:01 pm, kj wrote:
> In Perl, one can label loops for finer flow control. For example:
>
> X: for my $x (@X) {
> Y: for my $y (@Y) {
> for my $z (@Z) {
> next X if test1($x, $y, $z);
> next Y if test2($x, $y, $z);
> frobnicate($x, $y, $z);
> }
> glortz(
En Mon, 21 Sep 2009 06:17:20 -0300, daved170 escribió:
I need help with exceptions raising.
My goal is to print at the outer functions all the errors including
the most inner one.
The default exception report contains a lot of information, you don't have
to do anything special.
def foo1(
On Friday, 25 September 2009 19:11:06 Torsten Mohr wrote:
> I'd like to use a nested structure in memory that consists
> of dict()s and list()s, list entries can be dict()s, other list()s,
> dict entries can be list()s or other dict()s.
>
> The lists and dicts can also contain int, float, string,
Neil Hodgson wrote:
>Code signing certificates that will be be valid for Windows
> Authenticode cost $129 per year through CodeProject
That isn't an amount I am prepared to pay either :-) (I don't even use
Windows except as a glorified boot loader for Rise of Nations and to build
Python exten
Hi,
I am looking for a method in python that is similar to the function
str() in R, if you are familiar with R,
If you have no idea of R, what I want is to print the class
information of an object and the values of its members. Overloading
'__expr__' and '__repr__' then using 'print' can sort of
kj wrote:
Is there any way to specify unbuffered I/O from *within* the code
(rather than via the command-line -u flag)?
TIA!
kynn
When creating a file object, specify a buffer size of zero. I don't
know how to change the buffering of a file object that's already been
created, as stdin, s
On 20 Sep., 22:10, exar...@twistedmatrix.com wrote:
> On 07:10 pm, pengyu...@gmail.com wrote:
>
> >On Sun, Sep 20, 2009 at 11:31 AM, Daniel Fetchinson
> > wrote:
> >>>I am wondering what is the best way of organizing python source code
> >>>in a large projects. There are package code, testing code.
49 matches
Mail list logo