I'm looking for a nice tutorial or framework for developing Python written web applications.
I've done lots in PHP, but very little in Python or Ruby and figured I'd start with the first one alphabetically.
I have a strings like \uXXXX (representation) and I need to convert it into unicode.
I recieve it from 3rd party service so python interpreter don't convert it and I need convertion in my code.
How do I do it in Python?
>>> s
u'\\u0e4f\\u032f\\u0361\\u0e4f'
Is there any Python library that allows me to parse an HTML document similar to what jQuery does?
i.e. I'd like to be able to use CSS selector syntax to grab an arbitrary set of nodes from the document, read their content/attributes, etc.
The only Python HTML parsing lib I've used before was BeautifulSoup, and even though it's fine I keep thinking it would be faster to do my parsing if I had jQuery syntax available. :D
Hi,
I was studying introspection in Python, and as i was getting through basic examples, i found out that the "callable" built-in function is not longer available in Python 3.1.
How can i check if a method is callable now ?
Thank you
This is a code in python which calculates f (x) =? ((-1)*x)/(x*x+n*n) n from 1 to infinite....
correct to 0.0001, for the range 1 < x < 100 in steps of 0.1.But i am getting an syntax error,as i am new to programming in python...
from scipy import *
from matplotlib.pyplot import *
x=arange(0.1,100,0.1)
f=zeros(len(x))
s=-1
for n in range (1,10000):
t=s*x/(x*x+n*n)
f +=t
s =-s
if max(abs(t))< 1e-4
break
for xx in c_[x,f]:
print "%f %f" % (xx[0],xx[1])
is there an activerecord (any similar SQL-wrapper) for python? which is good for:
used in a server-side python script
light-weight
supports MySQL
what I need to do:
insert (filename, file size, file md5, the file itself) into (string, int, string, BLOB) columns
if the same file (checksum + filename) does not exist in db
thx
I'm trying to write a little budget program in python. This is my first program I'm writing to learn python. The first step is to calculate how many days until either the 1st or 15th (paydays) depending on today's date. Can someone help me out a little?
hi,
how to get in python from string not one character, but two?
I have:
long_str = 'abcd'
for c in long_str:
print c
and it gives me like
a
b
c
d
but i need to get
ab
cd
I'm new in python.. is there any way?
I have two servers - one Django, the other likely to be written in Python - and one is putting 'tasks' into a database and another is processing these tasks.
They share a database, but I want the processor to react quickly to new tasks rather than polling periodically.
Are there any straightforward ways for two Python servers to talk to one another, or does the task processor have to have web-hooks or something?
It feels there ought to be a blessed way to do this...
in python tutorial added that python cannot hide its attributes from other classes. some thing such as private data in C++ or java..But also i know that we can use _ or __ to set some variables as privated one but it is not enogh. I think it is a week if it is not any thing to do it.
hi expert, i'm newbie for python programming, i'm having a .py file, now what shall i do so i can create an application from .py file and it can be istall and run in any linux pc, i try to packaging it but its just create .tar file where i need python to run it, is it any to do so,
thanks
I want to be able to download a page and all of its associated resources (images, style sheets, script files, etc) using Python. I am (somewhat) familiar with urllib2 and know how to download individual urls, but before I go and start hacking at BeautifulSoup + urllib2 I wanted to be sure that there wasn't already a Python equivalent to "wget --page-requisites http://www.google.com".
Specifically I am interested in gathering statistical information about how long it takes to download an entire web page, including all resources.
Thanks
Mark
Hi,
I am looking for a python SOAP 1.2 client but it seems that it does not exist . All of the existing clients are either not maintainted or only compatible with SOAP 1.1:
suds
SOAPpy
ZSI
How can I return an response (lets say an array) to the client with a name assign to it form a python script.
echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';
in this scenario it returns an array with the name(jsonValidateReturn) assign to it also this can be accessed by jsonValidateReturn[1],so I want to do the same using a python script.
I tried it once but it didn't go well
array_to_js = [vld_id, vld_error, False]
array_to_js[2] = False
jsonValidateReturn = simplejson.dumps(array_to_js)
return HttpResponse(jsonValidateReturn, mimetype='application/json')
Thanks.
Could someone provide the best way to read xls files with python (not csv files).
if there a built in package which supported by default with python to this this task ?
Hello, python newbie here.
I'm going through python and I was wondering what are the advantages of using the *args as a parameter over just passing a list as a parameter, besides aesthetics?
Hey, I have a python application that opens some plots for me and then asks the user for input.
The problem is, that after opening the plot, the focus isn't on the terminal anymore, so you have to click or tab to it manually.
I would like to set the focus to the terminal window with python - is that possible?
I'm using gnuplot.py, maybe there is an option to open the plot in the background?
Thanks!
Is there a package naming convention for Python like Java's com.company.actualpackage? Most of the time I see simple, potentially colliding package names like "web".
If there is no such convention, is there a reason for it? What do you think of using the Java naming convention in the Python world?
I often do this to prepare for some django debugging:
Open up a terminal window in os x (10.6)
start the python interpreter
run these commands in python:
from django.core.management import setup_environ
import settings
setup_environ(settings)
Is it possible to automate these actions and make a shortcut that I can doubleclick to invoke?
hi,
I need to pass a callback function that is CFuncType (ctypes.CFUNCTYPE or ctypes.PYFUNCTYPE...).
How can I cast a python function to CFuncType or how can I create a CFuncType function in python.
I'm using python 2.5 in windows on a macbook pro with IDLE. How do I get previously typed commands in the python shell? In other operating systems I've managed to do this using 'ctrl' + 'up arrow' or a similar combination. I've tried all likely combinations without success.
Thanks.
i have this python script where i need to run 'gdal_retile.py'
but i get this an exception on this line:
if Verbose:
print(Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ')
the end='' is invalid syntax just curious as to why.. and what the author probably meant to do.
I'm new to python if you haven't already guessed.
i wonder if the multi threading in python/ruby is equivalent to the one in java?
by that i mean, is it as efficient?
cause if you want to create a chat application that use comet technology i know that you have to use multi threading.
does this mean that i can use python or ruby for that or is it better with java?
thanks
I'm new to Python so forgive me if this is basic, I've searched but can't find an answer. I'm trying to convert a Perl script into Python (3.x) which connects to a remote server and copies the files in a given directory to the local machine. Integrity of the transfer is paramount and there are several steps built-in to ensure a complete and accurate transfer.
The first step is to get a complete listing of the files to be passed to rsync. The Perl script has the following lines to accomplish this:
@dir_list = `ssh user@host 'find $remote_dir -type f -exec /bin/dirname {} \\;'`;
@file_list = `ssh user@host 'find $remote_dir -type f -exec /bin/basename {} \\;'`;
The two lists are then joined to create $full_list.
Rather than open two separate ssh instances I'd like to open one and use os.walk to get the information using:
for remdirname, remdirnames, remfilesnames in os.walk(remotedir):
for remfilename in remfilesnames:
remfulllist.append(os.path.join(remdirname, remfilename))
Thank you for any help you can provide.
My config file is really just a big python dict, but I have many config files to run different experiments and I want to 'import' a different one based on a command line option. Instinctively I want to do import ConfigFileName where ConfigFileName is a string with the config file's python package name in it... but that doesn't work.
Any ideas?