We're talking about uses; not static vs. dynamic typing, whitespace indentation, etc.
It seems Python and Java are similar in that they are both cross-platform and used in the desktop programming and server programming arts. How is Python being used like Java? Is it another good way to write your cross-platform software?
...
Python is doing string multiplication where I would expect it to do numeric multiplication, and I don't know why.
>>> print('%d' % 2 * 4)
2222
>>> print('%d' % (2 * 4))
8
Even forcing the type to integer does nothing. (I realize this is redundant, but it's an idiot-check for me:
>>> print('%d' % int(2) * int(4))
2222
Obviously I ...
I've looked at vObject, iCalendar and the official list of CalDAV libraries, including 3 in python. However, I can't find any code that can get me an event object from a given CalDAV (i.e. google, exchange, etc.) server using a username/password. Most of the django calendar related code uses native code libraries and not WebDAV.
An idea...
I am trying to use parameter substitution with SQLite within Python for an IN clause. Here is a complete running example that demonstrates:
import sqlite3
c = sqlite3.connect(":memory:")
c.execute('CREATE TABLE distro (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)')
for name in 'Ubuntu Fedora Puppy DSL SuSE'.split():
c.execute('...
I'm having problems with smtplib tying up my program when email sending fails, because a timeout is never raised. The server I'm using does not and will never have python greater than 2.4, so I can't make use of the timeout argument to the SMTP constructor in later versions of python.
Python 2.4's docs show that the SMTP class does not ...
Hi all,
Im writing a PyQt app that takes some input in one widget, and then processes some text files.
What ive got at the moment is when the user clicks the "process" button a seperate window with a QTextEdit in it pops up, and ouputs some logging messages.
On Mac OS X this window is refreshed automatically and you cna see the proces...
I've got the code below, and I was planning on making several classes all within the same "import". I was hoping to instantiate each class and get a return value with the widgets I'm making.
This isn't really a PyQt question at all, more of a "good practices" question, as I'll have a class for each widget.
Should I make functions th...
I'm trying to make my program faster, so I'm profiling it. Right now the top reason is:
566 1.780 0.003 1.780 0.003 (built-in method decode)
What is this exactly? I never call 'decode' anywhere in my code. It reads text files, but I don't believe they are unicode-encoded.
...
What is the best way to dynamically create a Python object instance when all you have is the Python class saved as a string?
For background, I am working in the Google Application Engine environment and I want to be able to load classes dynamically from a string version of the class.
problem = “1,2,3,4,5”
solvertext1 = “””class solv...
Hi,
I've created a HTML page with forms, which takes a name and password and passes it to a Python Script which is supposed to print the persons name with a welcome message. However, after i POST the values, i'm just getting the Python code displayed in the browser and not the welcome message. I have stored the html file and python file...
I have a script which uses the Django ORM features, amongst other external libraries, that I want to run outside of Django (that is, executed from the command-line).
Edit: At the moment, I can launch it by navigating to a URL...
How do I setup the environment for this?
...
Hi,
I have written a function comp(time1, time2) which will return true when time1 is lesser than time2. I have a scenario where time1 should always be lesser than time2. I need time1 to have the least possible value(date). How to find this time and how to form the corresponding object.
...
I need to find the difference between two pdf files. Does any any python related tool have a feature which directly gives the diff of the 2 PDFs?
...
Hi,
Is it possible to use XPath Query in Python while processing XML. I am using minidom which doesn't support that. Is there any other module for that?
...
Hi,
Context:
Imagine that you have a standard CherryPy hello word app:
def index(self):
return "Hello world!"
index.exposed = True
and you would like to do some post-processing, i.e. record request processing or just log the fact that we were called from specific IP. What you would do is probably:
def index(self):
sel...
How to get rid of the console that shows up as standard output when running wxPython programs in Windows?
...
When using ConfigParser module I would like to use values containing of multiple words set in cfg file. In this case seems trivial for me to surround the string with quotes like (example.cfg):
[GENERAL]
onekey = "value in some words"
My problem is that in this case python appends the quotes to the string as well when using the value l...
When i run a python script from the below java code, where an input file is given as an argument to the python script as well as an "-v" option, i get a IOException
String pythonScriptPath="\"C:\\Program Files\\bin\\CsvFile.py\"";
String Filepath="C:\\Documents and Settings\\user\\Desktop\\arbit.csv";
String[] cmd = new String[4];
cmd[0...
Hi All,
I have googled "python ssh". There is a wonderful module "pexpect", which can access a remote computer using ssh (with password).
After the remote computer is connected, I can execute other commands. However I cannot get the result in python again.
p = pexpect.spawn("ssh user@remote_computer")
print "connecting..."
p.waitnoe...
I'm thinking of switching from using PHP to Python for web applications, but I was wondering if Python is as adept as weaving in and out of HTML as PHP is. Essentially, I find it very easy/intuitive to use <? and ?> to put PHP where I want, and am then free to arrange/organize my HTML however I want. Is it just as easy to do this with Py...