I have created an XML file using python. But the XML declaration has only version info. How can I include encoding with XML declaration like:
<?xml version="1.0" encoding="UTF-8"?>
Hi folks,
Can anyone help me out in fitting a gamma distribution in python? Well, I've got some data : X and Y coordinates, and I want to find the gamma parameters that fit this distribution... In the Scipy doc, it turns out that a fit method actually exists but I don't know how to use it :s.. first, in wich format the argument "data" must be, and how can I provide the seconde argument (the parameters) since this what I'm looking for ???
Thanks a lot!
Hi there,
I'm currently aware of the following Python JIT compilers: Psyco, PyPy and Unladen Swallow.
Basically, I'd like to ask for your personal experiences on the strengths and weaknesses of these compilers - and if there are any others worth looking into.
Thanks in advance,
Az
I have a custom module in one of the directories in my PYTHONPATH with the same name as one of the standard library modules, so that when I import module_name, that module gets loaded. If I want to use the original standard library module, is there any way to force Python to import from the standard library rather than from the PYTHONPATH directory, short of renaming the custom module and changing every reference to point to the new name?
Hi,
I want to convert the mysql database table contents to an Excel(.xls) or comma seperated file(csv) using python script... Is it possible? Any one can help me?
Thanks in advance,
Nimmy
On Linux, how can I find the default gateway for a local ip address/interface using python?
I saw the question "How to get internal IP, external IP and default gateway for UPnP", but the accepted solution only shows how to get the local IP address for a network interface on windows.
Thanks.
I have an RRD database, and I want to parse some of the data in it. I found this:
http://pypi.python.org/pypi/PyRRD/0.0.7
but it basically just calls the command line tools (no parsing).
Does anyone know of a library that will actually parse the output of rrdtool dump?
Thanks!
I need to send a SOAP message (with Python SUDS) with strings encoded in 'iso-8859-2'.
Does anybody know how to do it?
SUDS raises the following exception when I invoke a method on a client with parameters encoded in 'iso-8859-2':
File "/home/bartek/myenv/lib/python2.5/site-packages/suds/sax/text.py", line 43, in __new__
result = super(Text, cls).__new__(cls, *args, **kwargs)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 10: ordinal not in range(128)
I am running ipython from sage and also am using some packages that aren't in sage (lxml, argparse) which are installed in my home directory. I have therefore ended up with a $PYTHONPATH of
$HOME/sage/local/lib/python:$HOME/lib/python
Python is reading and processing the first easy-install.pth it finds ($HOME/sage/local/lib/python/site-packages/easy-install.pth) but not the second, so eggs installed in $HOME/lib/python aren't added to the path. On reading the off-the-shelf site.py, I cannot for the life of me see why it's doing this.
Can someone enlighten me? Or advise how to nudge Python into reading both easy-install.pth files?
Consolidating both into one .pth file is a viable workaround for now, so this question is mostly for curiosity value.
How would I convert test cases made by Selenium IDE to Python without exporting every test case by hand? Is there any command line converter for that job?
In the end I want to use Selenium RC and Pythons build in unittest to test my websites.
Thanks a lot.
What is the best way of doing this in Python?
for (v = n / 2 - 1; v >= 0; v--)
I actually tried Google first, but as far as I can see the only solution would be to use while.
Hi,
My requirement is to search for jpeg images files in a directory using python script and list the file names. Can anyone help me on how to identify jpeg images files.
Thanks in advance...
I'd like to iterate over a list in Python several (say, 10) elements at a time, processing each slice one by one. I can think of a few ways to do this, but none seems obvious and clean. What is the most Pythonic way to do this?
Looking to put together a 3D side-scrolling action platformer. Since this is my first time trying to put together a non-simple adventure game, I'm at a loss for which engine to consider.
I would prefer one that supports scripting in python, since that's my primary language. Without tight controls, the game will suck... so speed is a priority. Cross-platform is also important to me.
Any suggestions?
I have an App Engine app written in Google's webapp framework and I want to add some credit card handling to it.
Does a library already exist to integrate payment processing into an App Engine Python app?
What tools are available in Python to assist in parsing a context-free grammar?
Of course it is possible to roll my own, but I am looking for a generic tool that can generate a parser for a given CFG.
I have a Python function that gives back some read-write buffer:
>>> x = h.GetEXlow()
>>> x
<read-write buffer ptr 0xa2b8140, size 2147483647 at 0x8b73f80>
Now I would like to memset the whole buffer content to zero. (The size stated above is obviously wrong, but I can determine the size without problems.) How do I do this?
Is there a way to get the ceil of a high precision Decimal in python?
>>> import decimal;
>>> decimal.Decimal(800000000000000000001)/100000000000000000000
Decimal('8.00000000000000000001')
>>> math.ceil(decimal.Decimal(800000000000000000001)/100000000000000000000)
8.0
math rounds the value and returns non precise value
This might be a really dumb question, however i've looked around online, etc. And have not seen a solid answer.
What i was wondering, is there a simple way to do something like this?
lines = open('something.txt', 'r').readlines()
for line in lines:
if line == '!':
# force iteration forward twice
line.next().next()
<etc>
Is there an easy way to do that in python?
I am writing a forum in Python. I want to strip input containing the right-to-left mark and things like that. Suggestions? Possibly a regular expression?
Suppose I have a python object x and a string s, how do I set the attribute s on x? So:
>>> x = SomeObject()
>>> attr = 'myAttr'
>>> # magic goes here
>>> x.myAttr
'magic'
What's the magic? The goal of this, incidentally, is to cache calls to x.__getattr__().
Hi,
I'd like to write some Python unit tests for my Google App Engine. How can I set that up? Does someone happen to have some sample code which shows how to write a simple test?