Basically, when generating plots with matplotlib, The scale on the y-axis goes into the millions. How do I turn on digit grouping (i.e. so that 1000000 displays as 1,000,000) or turn on the decimal separator?
...
Hi
here is the table
CREATE TABLE IF NOT EXISTS kompas_url
(
id BIGINT(20) NOT NULL AUTO_INCREMENT,
url VARCHAR(1000),
created_date datetime,
modified_date datetime,
PRIMARY KEY(id)
)
I am trying to do INSERT to kompas_url table only if url is not exist yet
any idea?
thanks
...
Trying to work with groupby so that I can group together files that were created on the same day. When I say same day in this case, I mean the dd part in mm/dd/yyyy. So if a file was created on March 1 and April 1, they should be grouped together because the "1" matches. Here's the code I have so far:
#!/usr/bin/python
import os
import ...
I'm running VLC (a media player) in Windows 7. Is there way to control (as in: play, pause, set volume) a running instance of VLC from Python?
...
I have been learning python for some time now. While starting this "learning python" endeavor I decided to learn the latest and greatest 3.1 version of python. I regret this decision now because I wanted to try my hands on some of the python web development frameworks & it looks like many of them do not support 3.1 yet & it looks like it...
I want to execute python code from C# with following code.
static void Main(string[] args)
{
ScriptEngine engine = Python.CreateEngine();
ScriptSource source = engine.CreateScriptSourceFromFile(@"F:\Script\extracter.py");
source.Execute();
}
I have the problem at line source.Execute(), I got error "N...
I have 1M numbers:N[], and 1 single number n, now I want to find in those 1M numbers that are similar to that single number, say an area of [n-10, n+10].
what's the best way in python to do this? Do I have to sort the 1M number and do an iteration?
Thanks
...
#Top half of triangle
for rows in range (5):
for row in range (12):
print("-", end='')
print()
for row in range (5):
stars=0
while stars<=row:
print("*", end='')
stars=stars+1
print()
for row in range(5):
star=4
while star>=row:
print("*", end='')
...
I just installed Pyevolve using easy_install and I am getting errors trying to run my first program. I first tried copy and pasting the source code of the first example but this is what I receive when I attempt to run it:
Traceback (most recent call last):
File "/home/corey/CTest/first_intro.py", line 3, in
from pyevolv...
I got the following code in javascript for RSA implementionhttp://www-cs-students.stanford.edu/~tjw/jsbn/:
// Return the PKCS#1 RSA encryption of "text" as an even-length hex string
function RSAEncrypt(text) {
var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3);
if(m == null) return null;
var c = this.doPublic(m);
if(c ==...
Hello all,
Recently I upgraded to Snow Leopard, and now I can't run programs built with wxPython. The errors I get are (from Eclipse + PyDev):
import wx
File "/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks
/Python.framework/Versions/2.6/Extras/lib/
python/wx-2.8-mac-unicode/wx/__init__.py", line 45, ...
I would like to adjust the system audio volume in OSX from a python script. This question about implementing keyboard shortcuts tells me how to do it in applescript, but I'd really like to do it from my python script without using os.system, popen, etc. Ideally I'd like to ramp up the volume slowly with some python code like this:
se...
I'm looking for a concise and functional style way to apply a function to one element of a tuple and return the new tuple, in Python.
For example, for the following input:
inp = ("hello", "my", "friend")
I would like to be able to get the following output:
out = ("hello", "MY", "friend")
I came up with two solutions which I'm not ...
What function to I use to redirect to the default 404 error page? Sample code appreciated. Thank you!
...
What is the right way to forming in-memory table in python with direct lookups for rows and columns.I thought of using dict of dicts this way,
class Table(dict):
def __getitem__(self, key):
if key not in self:
self[key]={}
return dict.__getitem__(self, key)
table = Table()
table['row1']['column1'] = 'val...
One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps:
User visits application
Thread starts
Until the thread finishes, that user's server instance hangs
Once the...
Can someone please explain algorithm for itertools.permutations routine in Python standard lib 2.6? I see its code in the documentation but don't undestand why it work?
Thanks
Code is:
def permutations(iterable, r=None):
# permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC
# permutations(range(3)) --> 012 021 10...
Hello,
I want to use the google maps hand cursor in Python but I don't know how to do it.
I've downloaded the cursor but I only get to use the hand open, I also have a event that "closes" the hand when clicked but I don't know how can I change the style cursor on it.
I say this because the google maps hand cursor has two style (the ope...
I am having an issue with PyQt4. I want to create a new widget within a window, and I want this widget to have a custom color.
When i create a subclass of the QWidget class, and instantiate it, I am not able to change its background color through the setStyleSheet() function.
When I instantiate a new QWidget object, I have no problem...
I am installing one library for python from MacPorts. But macports version of the library is older than actual development svn version. Is it possible to specify a custom location for a port installation in MacPorts so I could install latest library from the developer's site?
...