Chris Angelico ros...@gmail.com wrote:
On Tue, Mar 18, 2014 at 11:32 AM, Mok-Kong Shen
mok-kong.s...@t-online.de wrote:
Is there a way to force a certain ordering of the printout or else
somehow manage to get at least a certain stable ordering of the
printout (i.e. input and output are
Mark Lawrence breamore...@yahoo.co.uk wrote:
On 26/05/2013 04:55, cdorm...@gmail.com wrote:
This is a small little Project that I have started. Its a light
little Web Server (HTTPd) coded in python. Requirements: Python 2.7
= And Linux / BSD. I believe this could work in a CLI Emulator in
Carlos Nepomuceno carlosnepomuc...@outlook.com wrote:
Date: Sun, 26 May 2013 10:52:14 -0700
Subject: Cutting a deck of cards
From: rvinc...@gmail.com
To: python-list@python.org
Suppose I have a deck of cards, and I shuffle them
import random
cards
Carlos Nepomuceno carlosnepomuc...@outlook.com wrote:
From: usenetm...@solar-empire.de
[...]
Not in Python3.x
decks = 6
list(range(13 * 4 * decks)) == range(13 * 4 * decks)
False
What does list(range(13 * 4 * decks)) returns in Python 3?
Terry Reedy tjre...@udel.edu wrote:
On 2/12/2013 7:47 AM, Fayaz Yusuf Khan wrote:
dcomp = zlib.decompressobj(16+zlib.MAX_WBITS)
Since zlib.MAX_WBITS is the largest value that should be passed (15),
adding 16 makes no sense. Since it is also the default, there is also no
point in providing
Greg Donald gdon...@gmail.com wrote:
On Mon, Dec 10, 2012 at 10:34:31PM -0700, Michael Torrie wrote:
I use a module I got from pypi called dateutil. It has a nice submodule
called parser that can handle a variety of date formats with good
accuracy. Not sure how it works, but it handles all
Helmut Jarausch jarau...@skynet.be wrote:
I have a machine with a non-UTF8 local.
I can't figure out how to make numpy.genfromtxt work
[...]
#!/usr/bin/python3
import numpy as np
import io
import sys
inpstream = io.open(sys.stdin.fileno(), r, encoding='latin1')
data =
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
On Fri, 13 Jan 2012 06:14:50 -0800, mike wrote:
pysibelius is a lib that we use.
I am not sure that is the problem since the python program works on SuSE
but not on RH server. And AFAIK
the only difference ( well that I can see) is
Saqib Ali saqib.ali...@gmail.com wrote:
I'm using this decorator to implement singleton class in python:
http://stackoverflow.com/posts/7346105/revisions
The strategy described above works if and only if the Singleton is
declared and defined in the same file. If it is defined in a
Roy Smith r...@panix.com wrote:
I'm trying to use a custom version of mongoengine. I cloned the git
repo and put the directory on my PYTHONPATH, but python is still
importing the system's installed version. Looking at sys.path, it's
obvious why:
$ echo $PYTHONPATH
Makoto Kuwata k...@kuwata-lab.com wrote:
Is it possible to specify PREFIX directory for pip command by
environment variable?
I found that 'pip install --install-option=--prefix=PREFIX' works well,
but I don't want to specify '--install-option=--prefix=PREFIX' every time.
I prefer to specify
Yingjie Lin yingjie@mssm.edu wrote:
Hi Python users,
I have two lists:
li1 = ['a', 'b']
li2 = ['1', '2']
and I wish to obtain a list like this
li3 = ['a1', 'a2', 'b1', 'b2']
Is there a handy and efficient function to do this, especially when
li1 and li2 are long lists.
Daniel Kluev dan.kl...@gmail.com wrote:
test.py:
from threading import Thread
class X(object):
pass
obj = X()
obj.x = 0
def f(*args):
for i in range(1):
obj.x += 1
threads = []
for i in range(100):
t = Thread(target=f)
threads.append(t)
t.start()
for
Dan Stromberg drsali...@gmail.com wrote:
I've got a couple of programs that read filenames from stdin, and then
open those files and do things with them. These programs sort of do
the *ix xargs thing, without requiring xargs.
In Python 2, these work well. Irrespective of how filenames are
Neal Becker ndbeck...@gmail.com wrote:
Any idea what this could be about?
Traceback (most recent call last):
File run-tests-1004.py, line 48, in module
results = pool.map (run_test, cases)
File /usr/lib64/python2.7/multiprocessing/pool.py, line 199, in map
return
eliben [EMAIL PROTECTED] wrote:
Hello,
I want to be able to do something like this:
Employee = Struct(name, salary)
And then:
john = Employee('john doe', 34000)
print john.salary
Basically, Employee = Struct(name, salary) should be equivalent to:
class Employee(object):
def
Robert LaMarca [EMAIL PROTECTED] wrote:
Hi,
I am using numpy and wish to create very large arrays. My system is
AMD 64 x 2 Ubuntu 8.04. Ubuntu should be 64 bit. I have 3gb RAM and a
15 GB swap drive.
The command I have been trying to use is;
Alex Marandon [EMAIL PROTECTED] wrote:
Alexnb wrote:
I am wondering, is there a simple way to test for Internet connection? If
not, what is the hard way :p
Trying to fetch the homepage from a few major websites (Yahoo, Google,
etc.)? If all of them are failing, it's very likely that the
ssecorp [EMAIL PROTECTED] asked:
Why is this blowing the stack, thought it was tail-recursive...
Because python does no tail-call optimization.
Ciao
Marc
--
http://mail.python.org/mailman/listinfo/python-list
Joel Koltner [EMAIL PROTECTED] wrote:
Is there an easy way to get a list comprehension to produce a flat
list of, say, [x,2*x] for each input argument?
E.g., I'd like to do something like:
[ [x,2*x] for x in range(4) ]
...and receive
[ 0,0,1,2,2,4,3,6]
...but of course you really
Mark Dickinson [EMAIL PROTECTED] wrote:
On SuSE 10.2/Xeon there seems to be a rounding bug for
floating-point addition:
[EMAIL PROTECTED]:~ python
Python 2.5 (r25:51908, May 25 2007, 16:14:04)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type help, copyright, credits or license
Matt Porter [EMAIL PROTECTED] wrote:
Hi guys,
I'm trying to compress a string.
E.g:
BBBC - ABC
You mean like this?
''.join(c for c, _ in itertools.groupby(BBBCAADCASS))
'ABCADCAS'
HTH
Marc
--
http://mail.python.org/mailman/listinfo/python-list
globalrev [EMAIL PROTECTED] wrote:
class Foo(object):
def Hello(self):
print hi
object is purple, ie some sort of reserved word.
why is self in black(ie a normal word) when it has special powers.
Because `self` is just a name. Using `self` is a convention, but one
Alexander Schmolck [EMAIL PROTECTED] wrote:
Gary Herron [EMAIL PROTECTED] writes:
But... It's not!
A simple test shows that. I've attached a tiny test program that
shows this extremely clearly. Please run it and watch it fail.
In [7]: run ~/tmp/t.py
final count: 200
should
JYA [EMAIL PROTECTED] wrote:
for y in x.getElementsByTagName('display-name'):
elem.appendChild(y)
Like Gabriel wrote, nodes can only have one parent. Use
elem.appendChild(y.cloneNode(True))
instead. Or y.cloneNode(False), if you want a shallow copy (i.e.
Alex9968 [EMAIL PROTECTED] wrote:
Can I get sequence of all strings that can match a given regular
expression? For example, for expression '(a|b)|(x|y)' it would be ['ax',
'ay', 'bx', 'by']
It would be useful for example to pass these strings to a search engine
not supporting RegExp
sturlamolden [EMAIL PROTECTED] wrote:
On 18 Mar, 00:58, Jeff Schwab [EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
if parts == 0:
return []
q, r = divmod(distance, parts)
if r and parts % r:
q += 1
return [q] + make_slope(distance - q,
Tom Stambaugh [EMAIL PROTECTED] wrote:
Somehow I don't get what you are after. The ' doesn't have to be escaped
at all if are used to delimit the string. If ' are used as delimiters
then \' is a correct escaping. What is the problem with that!?
If I delimit the string with double quote,
[EMAIL PROTECTED] wrote:
I have a linux box with multiple ip addresses. I want to make my
python client connect from one of the ip addresses. Here is my code,
no matter what valid information I put in the bind it always comes
from the default ip address on the server. Am I doing something
jefm [EMAIL PROTECTED] wrote:
How can I print the unicode box drawing characters in python:
print u'\u2500'
print u'\u2501'
print u'\u2502'
print u'\u2503'
print u'\u2504'
Traceback (most recent call last):
File \test.py, line 3, in ?
print u'\u2500'
File
BlueBird [EMAIL PROTECTED] wrote:
On Dec 2, 4:27 pm, BlueBird [EMAIL PROTECTED] wrote:
On Nov 26, 5:07 pm, Sergio Correia [EMAIL PROTECTED] wrote:
Bluebird:
If you are using python 2.5, relative imports are no longer an
issue:http://docs.python.org/whatsnew/pep-328.html
It does not
Joshua Kugler [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
i tried a couple python json libraries. i used simplejson on the
server and was using cjson on the client, but i ran into this issue.
i'm now using simplejson on both sides, but i'm still interested in
this issue. did i do
?fldIdent=ksfofld_ident_type=ICAOver=0711bnSubmit=Complete+Search
Marc Christiansen [EMAIL PROTECTED] wrote:
The problem is this line:
META http-equiv=Content-Type content=text/html; charset=UTF-16
Which is wrong. The content is not utf-16 encoded. The line after that
declares the charset
Frank Stutzman [EMAIL PROTECTED] wrote:
I've got a simple script that looks like (watch the wrap):
---
import BeautifulSoup,urllib
ifile = urllib.urlopen(http://www.naco.faa.gov/digital_tpp_search.asp?fldId
Vladimir Rusinov [EMAIL PROTECTED] wrote:
I'm using beautiful soup html parser, and I need to get all 'div
class=g.../div' tags.
It can be done by:
import BeautifulSoup as BSoup
from BeautifulSoup import BeautifulSoup as BSoup
...
soup = BSoup(page)
for div in soup.findAll('div',
Fantus [EMAIL PROTECTED] wrote:
Hello
I am doing a small research and I found this:
http://www.freedom-to-tinker.com/tinyp2p.html
[...]
Now when I try to run a client using following command:
python tinyp2p.py haslo client http://10.10.10.1:2233 koniki
it gives me some strange
[EMAIL PROTECTED] wrote:
I've been searching to find a way to force this delete to work even if
the directory isn't empty. I've had no luck thus far. Anyone know
what that would be?
Answering your immediate question: you can't force os.removedirs to
delete non-empty dirs.
But
Casey [EMAIL PROTECTED] wrote:
I would recommend the OP try this:
run the (I)python shell and try the following:
a = [x for x in abcdefg]
a
['a','b','c','d','e','f','g']
c in a
True
c in a == True
False
(c in a) == True
True
The reason your conditional failed is that it was
Adam Hupp [EMAIL PROTECTED] wrote:
I've noticed some unexpected behavior with __builtins__ during module
import. It seems that during module import __builtins__ is a dict
but at all other times it is a module.
For example, if the file testmod.py has these contents:
print
Gabriel Genellina [EMAIL PROTECTED] wrote:
En Tue, 12 Jun 2007 05:46:25 -0300, [EMAIL PROTECTED] escribió:
On 6 12 , 3 16 , ici [EMAIL PROTECTED] wrote:
On Jun 12, 10:10 am, [EMAIL PROTECTED] wrote:
How could I format the float number like this: (keep 2 digit
precision)
Jeff Rollin [EMAIL PROTECTED] wrote:
I'm working with the Python Tutorial Byte of Python at swaroopch.info.
I have created the attached file, but when I execute:
% objvar.py
I get the error message:
(Initializing Calamity Jane)
Traceback (most recent call last):
File
Peter Otten [EMAIL PROTECTED] wrote:
Marc Christiansen wrote:
Gabriel Genellina [EMAIL PROTECTED] wrote:
En Tue, 12 Jun 2007 05:46:25 -0300, [EMAIL PROTECTED] escribió:
On 6 12 , 3 16 , ici [EMAIL PROTECTED] wrote:
On Jun 12, 10:10 am, [EMAIL PROTECTED] wrote:
How
Ivan Voras [EMAIL PROTECTED] scribis:
While using PyGTK, I want to try and define signal handlers
automagically, without explicitly writing the long dictionary (i.e. I
want to use signal_autoconnect()).
To do this, I need something that will inspect the current self and
return a dictionary
James T. Dennis [EMAIL PROTECTED] scribis:
In fact I realized, after reading through tempfile.py in /usr/lib/...
that the following also doesn't work like I'd expect:
# foo.py
tst = foo
def getTst(arg):
If I change this line:
return foo-%s % arg
to:
Timothy Smith [EMAIL PROTECTED] wrote:
i want to trunkate 199.999 to 199.99
getcontext.prec = 2 isn't what i'm after either, all that does is E's
the value.
do i really have to use floats to do this?
You could try this (from a script I use for my phone bill):
from decimal import Decimal as
Michael Spencer [EMAIL PROTECTED] wrote:
Nice. When you replace None by an object(), you have no restriction on
the elements any more:
Here's something to work with:
class OrdSet(object):
def __init__(self, iterable):
Build an ordered, unique collection of hashable items
Miki Tebeka [EMAIL PROTECTED] wrote:
Hello Nemesis,
Hi all, I'm trying to write a multiplatform function that tries to
return the actual user home directory.
...
What's wrong with:
from user import home
which does about what your code does.
Except it also execfile()s
[EMAIL PROTECTED] wrote:
Nick Coghlan [EMAIL PROTECTED] wrote:
Hmm, when the second argument is omitted, the system call looks like:
getservbyname(daytime, NULL);
Based on man getservbyname on my Linux PC, that should give
the behaviour we
want - any protocol will match.
However:
Riko Wichmann [EMAIL PROTECTED] wrote:
Jonathan Ellis wrote:
Sounds like your first step should be to identify yourself as IE.
opener = urllib2.build_opener(...)
opener.addheaders = [(User-Agent, whatever IE calls itself these
days)]
-Jonathan
Tried that already. At least, I hope
49 matches
Mail list logo