API key.
A similar tool I wrote (which pastes to codepad.org) is here:
https://bitbucket.org/prologic/tools/src/59d89262e6b1/codepad
The approach would be very similar. Feel free to adapt this.
cheers
James
--
-- James Mills
--
-- "Problems are
into which provides similar functionality.
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
thon", "installModule.py",
"--mods", "mod1", "mod2", "mod3"], stdout = subprocess.PIPE, stderr =
subprocess.STDOUT)
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
__
data)
...
>>> l = Tomato([1, 2, 3])
>>> l
[1, 2, 3]
>>>
Your example:
>>> class Tomato(list):
... def __init__(self, data):
... list.__init__(data)
...
>>> l = Tomato([1, 2, 3])
>>> l
[]
>>>
Do you see why ?
cheers
Jame
ing a pre-built binary
distribution (or a pure python lirbary).
Either way, you'll need MySQL install (at the very least mysqlxx.dll
or something)
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist -
On Tue, Apr 19, 2011 at 10:34 AM, James Mills
wrote:
> Normally it's considered bad practise to concatenate strings.
> Use a a format specifier like this:
>
>> message = "Bah."
>>
>> if test:
>> message = "%s %s" (message, " Humbug!
;install" the package into your site-packages or
$PYTHONPATH (if configured that way by means of configuration).
NB: Copying the package's directory into site-packages hwoever
has the same effect. The directory that contains the __init__.py
cheers
James
--
-- James Mills
--
--
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
..
This has a similar form to the code you're studying and registers func
with atexit hooks so that when
the application terminates, func(...) gets called.
Hope this helps,
cheers
James
1. http://www.python.org/dev/peps/pep-0318/
--
-- James Mil
/
2. http://bitbucket.org/prologic/circuits/wiki/Home
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Fri, Oct 15, 2010 at 11:22 AM, chris wrote:
>> But what if I want it to serve one client, go to another and then go back.
>> How does that work?
You do some I/O multi-plexing or multi-processing/threading.
You might want to do some reading on this.
cheers
James
--
--
init__("apple")
apple = Apple()
print apple.name
For more information, I suggest you start reading
the python tutorial (1)
cheers
James
1. http://docs.python.org/tutorial/
--
-- James Mills
--
-- "Problems are solved by method"
___
and wants to get
digests. It's far easier (for me at least) to just get each email as
it comes in.
--James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or ch
On Fri, Sep 17, 2010 at 12:13 PM, Bill Allen wrote:
> Is there a simple way to plot pixels in Python, without resorting to turtle
> graphics?
Give matplotlib a go.
Alternatively you may want to try pygame or pyglet.
cheers
James
--
-- James Mills
--
-- "Problems are solve
self.a = a
self.b = b
self.c = c
self.x = x
self.y = kwargs.get("y", None)
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
...
def foo(self, a, b, *args, **kwargs):
...
There are probably other combinations, but these are
probably the most common.
The point I'm trying to make here is that this is
really "up to you".
Use a combination of variable arguments (*args)
and maybe some arguments with defaul
, "copyright", "credits" or "license" for more information.
>>> s = "foo\"bar'"
>>> s
'foo"bar\''
>>> s.replace("\"", "").replace("'", "")
'foobar
On Tue, Sep 14, 2010 at 2:46 PM, wrote:
> rgenre = re.split(r';', rf.info["genre"])
> KeyError: 'genre'
Use something like this:
if "genre" in rf.info:
rgenre = re.split(..., ...)
else:
# ... no genre
cheers
James
--
-- Ja
(rgenre)<1: # I was hoping this would take care of the "there is
> no genre information" scenario but it doesn't
> rg1=rg2=rg3="NA"
the "else" statement does not expect (nor accept) an expression after
it, just write:
else:
...
;..."
s = raw_input(prompt)
while s:
if s == "hello":
hello()
elif s == "quit":
break
s = raw_input(prompt)
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Ssh'ing and executing remote commands might be
interpreted differently by the Cisco ssh/shell/etc.
It might be worth your while looking into this as it'll have nothing
at all to do with Python or Paramiko..
cheers
James
--
-- James Mills
--
-
" ssh into your Cisco routers and be presented
with a shell of some kind ?
cheers
James
PS: Please post to the list.
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change s
; commands.
What Router is this ? What OS does it run ?
I may have some experience with this as I often ssh into various
networking devices including Linux servers and systems, etc...
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
t; from time import time
>>> seed(time())
>>> def foo():
... if 0.5 < random() < 0.6:
... return True
...
>>> x = foo()
>>> while x is None:
... x = foo()
...
>>> x
True
>>>
cheers
James
--
-- James Mills
--
-- "Pro
have an entry point and an exit point.
main() and SystemExit exception.
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pyth
), delimiter='|',
> quoting=csv.QUOTE_NONE)
> for row in reader:
> print row
>
>
> I can print the file, I just need a little help searching and replacing
the column 4 data element.
Use re.match to match the column.
Use csv.writer to write our a new csv file
based on the
On Thu, Aug 5, 2010 at 2:38 PM, Vikram K wrote:
> Suppose i have this string:
> z = 'AT/CG'
>
> How do i get this list:
>
> zlist = ['A','T/C','G']
>>> import re
>>> z = 'AT/CG'
>>> [x for x in re.s
rn ""
...
>>> foo = Foo()
>>> foo
<__main__.Foo object at 0x83d796c>
>>> str(foo)
''
>>>
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Fri, Jul 30, 2010 at 12:22 PM, Richard D. Moores wrote:
> On Thu, Jul 29, 2010 at 19:10, James Mills
> wrote:
>> On Fri, Jul 30, 2010 at 11:47 AM, David Hutto wrote:
>>> This is basically to get feedback, on a better way to show the
>>> greatest common di
On Fri, Jul 30, 2010 at 12:10 PM, James Mills
wrote:
> def gcd(a, b):
> while b != 0:
> (a, b) = (b, a%b)
> return a
Here's another solution that uses a generator called factors to
generate a list of factors for any given value. The gcd function
then uses sets and
er method, or critique of what I've done, let me know.
[snip]
I have a far simpler solution:
>>> from tools import gcd
>>> gcd(20, 5)
5
>>>
def gcd(a, b):
while b != 0:
(a, b) = (b, a%b)
return a
cheers
James
-
On Thu, Jan 29, 2009 at 12:17 PM, bmol...@att.net wrote:
> yes, i'm running on Mac OS X / Unix, but i'm afraid i don't know "where" to
> change the port to 80. i'm working with the following files straight from
> the book 'Programming Python':
You're not blind are you ? Because I am.
> cgi101.p
On Thu, Jan 29, 2009 at 11:31 AM, bmol...@att.net wrote:
> Traceback (most recent call last):
> File "webserver.py", line 22, in ?
>srvrobj = HTTPServer(srvraddr, CGIHTTPRequestHandler)
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/SocketServer.py",
> line
"cmd" has _nothing_ to do with Python.
--JamesMills
--
-- "Problems are solved by method"
On Mon, Dec 15, 2008 at 10:51 PM, Lamonte Harris wrote:
> Every time I start cmd on windows it requires me to "set
> path=%path%;C:\python26" why? I'm getting annoyed...
>
> --
> http://mail.python.org/m
34 matches
Mail list logo