Hi Guys,
I have created regular expression with os modules, I have created file
sdptool to match the regular expression pattern, will print the result.
I want without creating file how to get required output, I tried but i
didn't get output correctly, over stream.
#! /usr/bin/python
import os,re
Ganesh Kumar writes:
> Hi Guys,
>
> I have created regular expression with os modules, I have created file
> sdptool to match the regular expression pattern, will print the result.
> I want without creating file how to get required output, I tried but i
> didn't get output correctly, over stream.
in my xp ,python26,easy_install installed.
i want to install lxml in window xp
1.c:\python26\scripts\easy_install lxml
what i get is:
Reading http://codespeak.net/lxml
Best match: lxml 2.3.3
Downloading http://lxml.de/files/lxml-2.3.3.tgz
Processing lxml-2.3.3.tgz
Running lxml-2.3.3\setup.p
水静流深, 09.01.2012 10:18:
> in my xp ,python26,easy_install installed.
> i want to install lxml in window xp
> 1.c:\python26\scripts\easy_install lxml
>
> what i get is:
>
> Reading http://codespeak.net/lxml
> Best match: lxml 2.3.3
> Downloading http://lxml.de/files/lxml-2.3.3.tgz
> Processi
On 1/9/12 5:35 AM, John Nagle wrote:
Python has some serious problems that preclude optimization.
Basically, the language is designed to be run by a naive (non-optimizing)
interpreter, and allows things that are easy
for such an implementation but very tough to optimize. An
example is the abilit
THE EXPANSION OF THE UNIVERSE IN THE QURAN
What you are about to read might sound unusual but it could be very
enlightened
In 1929, in the California Mount Wilson observatory, an American
astronomer by the name of Edwin Hubble made one of the greatest
discoveries in the history of astronomy. Whi
On 01/09/2012 09:03 AM, Eelco wrote:
i havnt read every post in great detail, but it doesnt seem like your
actual question has been answered, so ill give it a try.
AFAIK, changing __dict__ to be an ordereddict is fundamentally
impossible in python 2. __dict__ is a builtin language construct
hard
Am 09.01.2012 13:10, schrieb Lie Ryan:
I was just suggesting that what the OP thinks he wants is quite
likely not what he actually wants.
Rest assured that the OP has a rather good idea of what he wants and
why, the latter being something you don't know, because he never
bothered to explain
In article ,
Ian Kelly wrote:
> Randomizing the order is not a bad idea, but you also need to be able
> to run the tests in a consistent order, from a specific random seed.
> In the real world, test conflicts and dependencies do happen, and if
> we observe a failure, make a change, rerun the tes
On 2012-01-09, Roy Smith wrote:
> If somebody (i.e. the classic "consenting adult" of the Python
> world) wants to take advantage of that to write a test suite
> where the tests *do* depend on each other, and have to be run
> in a certain order, there's nothing wrong with that. As long
> as they
Am 09.01.2012 15:35, schrieb Roy Smith:
The classic unittest philosophy says that tests should be independent of
each other, which means they should be able to be run in arbitrary
order. Some people advocate that the test framework should
intentionally randomize the order, to flush out inter-tes
On Mon, Jan 9, 2012 at 9:59 AM, Ulrich Eckhardt
wrote:
> There is another dependency and that I'd call a logical dependency. This
> occurs when e.g. test X tests for an API presence and test Y tests the API
> behaviour. In other words, Y has no chance to succeed if X already failed.
> Unfortunatel
Can you please explain me what the [0] in host =
socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] does at the end?
Why not just host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )
instead? what is the need of [0] ?
--
http://mail.python.org/mailman/listinfo/python-list
On 1/9/2012 2:19 PM, Νικόλαος Κούρας wrote:
Can you please explain me what the [0] in host =
socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] does at the end?
Why not just host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )
instead? what is the need of [0] ?
The address database can h
Hello,
I have a class and i return both a key list and dictionary from the class.
Is it good form to do this? The print helo.__dict__ shows both the list and
dictionary.
>>> class Parse_Nagios_Header:
... def __init__(self):
... self.keylist = []
... self.d = {}
...
On 10 Ιαν, 00:35, Dominic Binks wrote:
> On 1/9/2012 2:19 PM, Νικόλαος Κούρας wrote:
>
> > Can you please explain me what the [0] in host =
> > socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] does at the end?
>
> > Why not just host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )
> > inst
On Tue, Jan 10, 2012 at 9:35 AM, Dominic Binks wrote:
> The address database can have multiple names for the same IP address so
> gethostbyaddr returns a list - [0] being the first item in the list (and
> usually considered the canonical name)
Point to note: The inverse operation, getting IP addr
On Mon, Jan 9, 2012 at 2:51 PM, david.gar...@gmail.com
wrote:
class Parse_Nagios_Header:
> ... def __init__(self):
> ... self.keylist = []
> ... self.d = {}
> ... def __iter__(self):
> ... return iter(self.keylist, self.d)
No idea what you're expecting this
On Mon, Jan 9, 2012 at 3:51 PM, david.gar...@gmail.com
wrote:
> ... def __iter__(self):
> ... return iter(self.keylist, self.d)
This method is incorrect. The 2-argument form of iter() is very
different from the 1-argument form. Whereas the 1-argument form takes
an iterable, the 2-ar
dataset = cursor.fetchall()
for row in dataset:
print ( "" )
for item in row:
print ( " %s " % item )
and this:
dataset = cursor.fetchall()
for host, hits, agent, date in dataset:
Chris,
Both a list and dict are both iterable. I get a python dictionary object
of both iterables.;) It is nice... but I don't know if this is good form?
Should I be asking the duck question here?
>>> print helo.__dict__
{'keylist': [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20,
Chris Angelico wrote:
> On Tue, Jan 10, 2012 at 9:35 AM, Dominic Binks wrote:
> > The address database can have multiple names for the same IP address so
> > gethostbyaddr returns a list - [0] being the first item in the list (and
> > usually considered the canonical name)
>
> Point to note: Th
2012/1/9 Νικόλαος Κούρας :
>
> dataset = cursor.fetchall()
>
> for row in dataset:
> print ( "" )
>
> for item in row:
> print ( " %s " % item )
>
>
> and this:
>
>
> dataset = cursor.fet
On Mon, Jan 9, 2012 at 4:30 PM, david.gar...@gmail.com
wrote:
> Chris,
>
> Both a list and dict are both iterable. I get a python dictionary object of
> both iterables.;) It is nice... but I don't know if this is good form?
> Should I be asking the duck question here?
print helo.__dict__
[SN
On Mon, Jan 9, 2012 at 3:23 PM, Νικόλαος Κούρας wrote:
>
> dataset = cursor.fetchall()
>
> for row in dataset:
> print ( "" )
>
> for item in row:
> print ( " %s " % item )
>
>
> and this:
>
Your second snippet makes u
On Mon, Jan 9, 2012 at 3:30 PM, david.gar...@gmail.com
wrote:
> Chris,
>
> Both a list and dict are both iterable. I get a python dictionary object of
> both iterables.;)
No, you get a Python object with both iterables as instance variables.
Instance variables happen to be stored using a dict (w
Στις 10 Ιανουαρίου 2012 1:42 π.μ., ο χρήστης Ian Kelly <
ian.g.ke...@gmail.com> έγραψε:
>
> > b) In the 2nd example we have for 'host, hits, agent, date in
> > dataset'. How does these 4 variables take their values out of dataset?
> > How dataset is being splitted?
>
> The second example works the
Thanks Ian & Chris for the conversation...
On Mon, Jan 9, 2012 at 4:15 PM, Chris Rebert wrote:
> On Mon, Jan 9, 2012 at 3:30 PM, david.gar...@gmail.com
> wrote:
> > Chris,
> >
> > Both a list and dict are both iterable. I get a python dictionary
> object of
> > both iterables.;)
>
> No, you
I want to forbid my application to access the filesystem. The easiest
way seems to be chrooting and droping privileges. However, surprisingly,
python loads the codecs from the filesystem on-demand, which makes my
program crash:
>>> import os
>>> os.getuid()
0
>>> os.chroot('/tmp')
>>> ''.decode('r
On 09/01/2012 22:51, david.gar...@gmail.com wrote:
Hello,
I have a class and i return both a key list and dictionary from the
class. Is it good form to do this? The print helo.__dict__ shows both
the list and dictionary.
>>> class Parse_Nagios_Header:
... def __init__(self):
...
In article <11jrt8-l32@satorlaser.homedns.org>,
Ulrich Eckhardt wrote:
> > Some people advocate that the test framework should
> > intentionally randomize the order, to flush out inter-test dependencies
> > that the author didn't realize existed (or intend).
>
> If you now
> happen to infl
2012/1/9 Νικόλαος Κούρας :
> if the MySQL query was:
>
> cursor.execute( '''SELECT host, hits, agent, date FROM visitors WHERE pin =
> %s ORDER BY date DESC''', pin )
>
> can you help me imagine how the mysql database cursor that holds the query
> results would look like? I must somehow visualize i
I see your meaning for __iter__ method.;)
On Mon, Jan 9, 2012 at 4:57 PM, david.gar...@gmail.com <
david.gar...@gmail.com> wrote:
> Thanks Ian & Chris for the conversation...
>
>
>
>
> On Mon, Jan 9, 2012 at 4:15 PM, Chris Rebert wrote:
>
>> On Mon, Jan 9, 2012 at 3:30 PM, david.gar...@gmail.com
*Here is a good tutorial:
http://shutupandship.com/articles/iterators/index.html
*
On Mon, Jan 9, 2012 at 5:22 PM, david.gar...@gmail.com <
david.gar...@gmail.com> wrote:
> I see your meaning for __iter__ method.;)
>
>
> On Mon, Jan 9, 2012 at 4:57 PM, david.gar...@gmail.com <
> david.gar...@gmai
On Tue, Jan 10, 2012 at 10:32 AM, Nick Dokos wrote:
> Chris Angelico wrote:
>> Point to note: The inverse operation, getting IP addresses from names,
>
> so socket.gethostbyaddr(os.environ['REMOTE_ADDR'])[0] is the 0th element
> of the tuple, i.e. the *name* that is returned.
Correct, I was draw
Many thanks mrabarnett for the code critic...
On Mon, Jan 9, 2012 at 5:08 PM, MRAB wrote:
> On 09/01/2012 22:51, david.gar...@gmail.com wrote:
>
>> Hello,
>>
>> I have a class and i return both a key list and dictionary from the
>> class. Is it good form to do this? The print helo.__dict__ sho
code1:
def FirstDeco(func):
print 'haha'
y=func()
return y
print y
@FirstDeco
def test():
print 'asdf'
return 7
result :
haha
asdf
code2:
def FirstDeco(func):
print 'haha'
y=func()
#return y
print y
@FirstDeco
def test():
print 'asdf'
return 7
result :
h
On Mon, Jan 9, 2012 at 7:35 PM, contro opinion wrote:
> code1:
>
> def FirstDeco(func):
> print 'haha'
> y=func()
> return y
> print y
Since there's a `return` right before it, the latter `print` here will
*never* be executed.
Cheers,
Chris
--
http://mail.python.org/mailman/listinf
test1.py
def deco(func):
print 'i am in deco'
return func
@deco
def test():
print 'i am in test'
when you run it ,you get :
test2.py
def tsfunc(func):
def wrappedFunc():
print '[%s] %s() called' % (ctime(), func.__name__)
print 'i am in deco'
return func(
test1.py
def deco(func):
print 'i am in deco'
@deco
def test():
print 'i am in test'
when you run it ,you get :
i am in deco
test2.py
def tsfunc(func):
def wrappedFunc():
print 'i am in deco'
return func()
return wrappedFunc
@tsfunc
def test():
On 1/9/2012 8:05 PM, Roy Smith wrote:
In article<11jrt8-l32@satorlaser.homedns.org>,
Ulrich Eckhardt wrote:
Some people advocate that the test framework should
intentionally randomize the order, to flush out inter-test dependencies
that the author didn't realize existed (or intend).
If
Using python 3.2 in Windows 7 I am getting the following:
>>compile('pass', r'c:\temp\工具\module1.py', 'exec')
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1:
invalid character
Can anybody explain why the compile statement tries to convert the unicode
filename using mb
def deco(func):
def wrap():
print 'i am in deco'
return func()
return wrap
@deco
def test():
print "i am in test"
when you run it ,there is no result ,
def deco(func):
print 'i am in deco'
return func()
@deco
def test():
print "i am in test"
w
Suppose I've got a Python daemon that spawns a bunch of worker threads, waits
for a singal (e.g. SIGTERM) and then shuts down the worker threads gracefully.
What's the simplest way to do the signal handling portably across as many
operating systems as possible (at least Linux and FreeBSD). Speci
On Mon, Jan 9, 2012 at 8:14 PM, contro opinion wrote:
> test1.py
>
> def deco(func):
> print 'i am in deco'
>
> @deco
> def test():
> print 'i am in test'
>
>
> when you run it ,you get :
> i am in deco
>
>
>
> test2.py
>
> def tsfunc(func):
> def wrappedFunc():
> print 'i
On Mon, Jan 9, 2012 at 7:59 PM, contro opinion wrote:
> test1.py
>
> def deco(func):
> print 'i am in deco'
> return func
>
> @deco
>
> def test():
> print 'i am in test'
>
> when you run it ,you get :
>
>
>
> test2.py
>
> def tsfunc(func):
> def wrappedFunc():
> print '[%s] %s
Cheers,
Chris
--
http://rebertia.com
On Mon, Jan 9, 2012 at 8:34 PM, contro opinion wrote:
>
> def deco(func):
> def wrap():
> print 'i am in deco'
> return func()
> return wrap
>
> @deco
> def test():
> print "i am in test"
> when you run it ,there is no result ,
>
Chris Rebert於 2012年1月10日星期二UTC+8下午1時15分53秒寫道:
> On Mon, Jan 9, 2012 at 8:14 PM, contro opinion wrote:
> > test1.py
> >
> > def deco(func):
> > print 'i am in deco'
> >
> > @deco
> > def test():
> > print 'i am in test'
> >
> >
> > when you run it ,you get :
> > i am in deco
> >
> >
> >
>
Am 09.01.2012 23:35 schrieb Dominic Binks:
On 1/9/2012 2:19 PM, Νικόλαος Κούρας wrote:
Can you please explain me what the [0] in host =
socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] does at the end?
Why not just host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )
instead? what is th
On Tue, Jan 10, 2012 at 5:42 PM, Thomas Rachel
wrote:
> BTW: This behaviour might be useful with gethostbyaddr() as well - if the
> first one returned has gone away, you have the chance to reach the 2nd
> one...
In its directest sense, probably not. All you're getting is multiple
names for the sa
50 matches
Mail list logo