Search Results

Search found 15187 results on 608 pages for 'boost python'.

Page 69/608 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Java code translation of Python array-splitting code

    - by techventure
    Can someone please give the Java equivalent of the below python (which slices a given array into given parts) which was originally written by ChristopheD here: def split_list(alist, wanted_parts=1): length = len(alist) return [ alist[i*length // wanted_parts: (i+1)*length // wanted_parts] for i in range(wanted_parts) ] I don't know any python but can really use the above code in my Java app. Thanks

    Read the article

  • unable to import libxml2mod from the python script

    - by shahjapan
    File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in <module> import libxml2mod ImportError: /usr/local/lib/python2.5/site-packages/libxml2mod.so: undefined symbol:xmlTextReaderSetup >>> import libxml2mod >>> import libxml2 >>> on Python Prompt it works fine !! can anyone has idea why my program is not working from .py file as import is working perfect from python prompt.

    Read the article

  • Instance variables vs. class variables in Python

    - by deamon
    I have Python classes, of which I need only one instance at runtime, so it would be sufficient to have the attributes only once per class and not per instance. If there would be more than one instance (what won't happen), all instance should have the same configuration. I wonder which of the following options would be better or more "idiomatic" Python. Class variables: MyController(Controller): path = "something/" childs = [AController, BController] def action(request): pass Instance ariables: MyController(Controller): def __init__(self): self.path = "something/" self.childs = [AController, BController] def action(self, request): pass

    Read the article

  • Schedule Python Script - Windows 7

    - by Btibert3
    Hi Everyone, I am really new to Python, and programming in general, but I have a python script I would like to run at regular intervals. I am running windows 7. What is the best way to accomplish this? Easiest way? Any help you can provide will be very much appreciated! Brock

    Read the article

  • Problem with building OpenCV for Python 2.6

    - by si14
    I've just downloaded OpenCV's trunk and now I'm trying to build it with MinGW. I read the manual and get .dll's compiled, but that's all - "interfaces/python" contains only some .i and .cmake files. How can I really get new python interface? Where I can find new cv.pyd/libcv.dll.a (because a compiled version from official site crashes sometimes and I saw this bug as "fixed" in Trac)?

    Read the article

  • Creating constant in Python

    - by zfranciscus
    Hi, Is there a way to declare a constant in Python. In java I will we can create constant in this manner: public static final String CONST_NAME = "Name"; What is the equivalent of the above java constant declaration in python ? Cheers,

    Read the article

  • Keyboard input with timeout in Python

    - by J. Pablo Fernández
    How would you prompt the user for some input but timing out after N seconds? Google is pointing to a mail thread about it at http://mail.python.org/pipermail/python-list/2006-January/533215.html but it seems not to work. The statement in which the timeout happens, no matter whether it is a sys.input.readline or timer.sleep(), I always get: <type 'exceptions.TypeError'>: [raw_]input expected at most 1 arguments, got 2 which somehow the except fails to catch.

    Read the article

  • Enforce "spaces" or "tabs" only in python files ?

    - by edomaur
    In Python, is there a mean to enforce the use of spaces or tabs indentation with a per file basis ? Well, perhaps "enforce" is too strong, its more like "recommands". I keep getting files with mixed indentation and this is annoying... (to say the least) Python itself can tell when there is a problem, but I am searching something to do that at the editor level, like it exists for the charset.

    Read the article

  • Python, Unicode, and the Windows console

    - by James Sulak
    When I try to print a Unicode string in a windows console, I get a "UnicodeEncodeError: 'charmap' codec can't encode character ...." error. I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Python automatically print a "?" instead of failing in this situation? Edit: I'm using Python 2.5.

    Read the article

  • Python 3.1 twitter post with installed library,

    - by Andrew
    I'd like to be able to post twitter messages from python 3.0. None of the twitter API I have looked at support python 3.1. Since the post proceedure only requires this : JSON: curl -u username:password -d status="your message here" http://api.twitter.com/1/statuses/update.json I was wondering if it is possible with the standard libraries to format this so a message could be sent. My head says it should be possible.

    Read the article

  • Ruby LESS gem equivalent in Python

    - by Sean M
    The Ruby LESS gem looks awesome - and I am working on a Python/Pylons web project where it would be highly useful. CSS is, as someone we're all familiar with recently wrote about, clunky in some important ways. So I'd like to make it easier on myself. Is there an existing Python module or library that provides parallel functionality?

    Read the article

  • Python Application in right click menu of OS X

    - by Mark Underwood
    Hi All, I know that there is the PyObjC bridge is OSX and what I want to do is to put a python application/script in the rightclick context menu of OS X. there is the OnMyCommand plugin but I dont think that supports python. I've had a look at how to do it in Carbon/ Objective-C and i'll admit it im a wuss and am just not smart enough yet to grok how to do it (I aint even close to groking it actually.) Anybody got any idea's on how I might go about this? Cheers

    Read the article

  • python script to download xml files on my server

    - by Blankman
    I need a python script that will do the following: connect to a URL, and that URL will return a number like 1200. Use the number, to download xml files named: 1 to x where x is the number from #1. store the files in a particular directory. Sorry I've never written a python script, so if you could guide me along that would be great (maybe with a some comments). I will be running this as a cron job if that matters.

    Read the article

  • Evaluating mathematical expressions in Python

    - by vander
    Hi, I want to tokenize a given mathematical expression into a binary tree like this: ((3 + 4 - 1) * 5 + 6 * -7) / 2 '/' / \ + 2 / \ * * / \ / \ - 5 6 -7 / \ + 1 / \ 3 4 Is there any pure Python way to do this? Like passing as a string to Python and then get back as a tree like mentioned above. Thanks.

    Read the article

  • Parameters with braces in python

    - by Leif Andersen
    If you look at the following line of python code: bpy.ops.object.particle_system_add({"object":bpy.data.objects[2]}) you see that in the parameters there is something enclosed in braces. Can anyone tell me what the braces are for (generically anyway)? I haven't really seen this type of syntax in python and I can't find any documentation on it. Any help is greatly appreciated. Thank you.

    Read the article

  • meaning of the returned list of python json

    - by fmsf
    Hey, I'm new to python so I really don't know the language very well. the following example was taken from here http://docs.python.org/library/json.html >>> import json >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] what does the u mean? and how do i know which elements are available in the dictionary?

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >