Search Results

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

Page 114/608 | < Previous Page | 110 111 112 113 114 115 116 117 118 119 120 121  | Next Page >

  • Exact cin equivalent function in python

    - by gkt.pro
    Suppose user enter this string at terminal 123 456 456 //then hit enter How do I scan these three (could be more) numbers in different variables in python Could be something like this: for i in range(1,n) m[i]=#WHAT FUNCTION SHOULD I PUT HERE In c++ we can easily use cin>>m[i] inside above loop to scan the variables. If i use input() or raw_input() , they would scan whole line in single variable.

    Read the article

  • How do I set a property in python using its string name

    - by dave
    Hey, here's a dumb question: how can I set an object property given its name in a string. I have a dictionary being passed to me and I wish to transfer its values into namesake properties using code like this: for entry in src_dict: if entry.startswith('can_'): tgt_obj[entry] = src_dict_profile[entry] I'm still a bit of a noob with Python so would appreciate some help. - dave.

    Read the article

  • Find Hyperlinks in Text using Python (twitter related)

    - by TimLeung
    How can I parse text and find all instances of hyperlinks with a string? The hyperlink will not be in the html format of <a href="http://test.com">test</a> but just http://test.com Secondly, I would like to then convert the original string and replace all instances of hyperlinks into clickable html hyperlinks. I found an example in this thread: Easiest way to convert a URL to a hyperlink in a C# string? but was unable to reproduce it in python :(

    Read the article

  • Python-mode import problem

    - by smith
    I'm trying to use Emacs as a python editor and it works fine when I evaluate(C-c C-c) only single files but when I evaluate a file that imports another file in the same directory, I get an error saying that the file could not be imported. Does anyone know of a workaround? Thanks in advance

    Read the article

  • SOAP 1.2 python client

    - by Bluebird75
    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

    Read the article

  • Best (or appropriate) WSGI server for this Python script? - Python

    - by RadiantHex
    Hi folks, I'm having quite a problem deciding how to serve a few Python scripts. The problem is that the basic functionality could be generalized by this: do_something() time.sleep(3) do_something() I tried various WSGI servers, but they have all been giving me concurrency limitations, as in I have to specify how many threads to use and so on. I only wish that the resources on the server be used efficiently and liberally. Any ideas?

    Read the article

  • Python: if key in dict vs. try/except

    - by LeeMobile
    I have a question about idioms and readability, and there seems to be a clash of Python philosophies for this particular case: I want to build dictionary A from dictionary B. If a specific key does not exist in B, then do nothing and continue on. Which way is better? try: A["blah"] = B["blah"] except KeyError: pass or if "blah" in B: A["blah"] = B["blah"] "Do and ask for forgiveness" vs. "simplicity and explicitness". Which is better and why?

    Read the article

  • python: equivalent to Javascript "||" to override non-truthful value

    - by Jason S
    In Javascript I can do this: function A(x) { return x || 3; } This returns 3 if x is a "non-truthful" value like 0, null, false, and it returns x otherwise. This is useful for empty arguments, e.g. I can do A() and it will evaluate as 3. Does Python have an equivalent? I guess I could make one out of the ternary operator a if b else c but was wondering what people use for this.

    Read the article

  • Comparing two text files in python

    - by tazim
    Hi, I need to compare two files and redirect the different lines to third file. I know using diff command i can get the difference . But, is there any way of doing it in python ? Any sample code will be helpful

    Read the article

  • In Python, how do I decode GZIP encoding?

    - by alex
    I downloaded a webpage in my python script. In most cases, this works fine. However, this one had a response header: GZIP encoding, and when I tried to print the source code of this web page, it had all symbols in my putty. How do decode this to regular text?

    Read the article

  • 2d convolution using python and numpy

    - by mikip
    Hi I am trying to perform a 2d convolution in python using numpy I have a 2d array as follows with kernel H_r for the rows and H_c for the columns data = np.zeros((nr, nc), dtype=np.float32) #fill array with some data here then convolve for r in range(nr): data[r,:] = np.convolve(data[r,:], H_r, 'same') for c in range(nc): data[:,c] = np.convolve(data[:,c], H_c, 'same') It does not produce the output that I was expecting, does this code look OK Thanks

    Read the article

  • [Embedded Python] Invoking a method on an object

    - by jmucchiello
    Given a PyObject* pointing to a python object, how do I invoke one of the object methods? The documentation never gives an example of this: PyObject* obj = .... PyObject* args = Py_BuildValue("(s)", "An arg"); PyObject* method = PyWHATGOESHERE(obj, "foo"); PyObject* ret = PyWHATGOESHERE(obj, method, args); if (!ret) { // check error... } This would be the equivalent of >>> ret = obj.foo("An arg")

    Read the article

  • traverse a binary decison tree using python?

    - by kaushik
    how to traverse a binary decision tree using python language. given a tree,i want know how can we travesre from root to required leaf the feature of the required leaf are given in an dictionary form assume and have to traverse from root to leaf answering the questions at each node with the details given in feature list.. the decision tree node has format ((question)(left tree)(right tree)) while traversing it should answer question at each node and an choose left or right and traverse till leaf?

    Read the article

  • Good practice of using list of function in Python

    - by riskio
    I am pretty new to python and I discovered by myself that I can create a list of function and call with a for loop. example: def a(args): print "A" def b(args): print "B" def c(args): print "C " + str(args) functions = [a,b,c] for i in functions: i(1) So, my question is: is there any good practice or elegant way to use list of functions and what is a good use of all this? (do have a particular name the "list of functions"?) thank you

    Read the article

  • Limiting the size of a python dictionary

    - by anthony
    I'd like to work with a dict in python, but limit the number of key/value pairs to X. In other words, if the dict is currently storing X key/value pairs and I perform an insertion, I would like one of the existing pairs to be dropped. It would be nice if it was the least recently inserted/accesses key but that's not completely necessary. If this exists in the standard library please save me some time and point it out!

    Read the article

  • How to print source code lines in python logger

    - by anon
    Is there some relatively simple way to programmatically include source code lines to python logger report. For example... import logging def main(): something_is_not_right = True logging.basicConfig(level=logging.DEBUG, format=('%(filename)s: ' '%(levelname)s: ' '%(funcName)s(): ' '%(lineno)d:\t' '%(message)s') ) if something_is_not_right == True: logging.debug('some way to get previous line of source code here?') So that output would look like this. example.py: DEBUG: main(): 14: if something_is_not_right == True:

    Read the article

  • Session handling in python / django

    - by Gaurav
    I am creating an application that lets users login using Google, Facebook and the website's native login. The site is being built in Python / Django. What would be the best way to handle login, session management and user authentication? I do not want to use the in-built Django user management. I am using Django very sparingly(URLs, templates)

    Read the article

  • Built in python hash() function

    - by sm1
    Windows XP, Python 2.5: hash('http://stackoverflow.com') Result: 1934711907 Google App Engine (http://shell.appspot.com/): hash('http://stackoverflow.com') Result: -5768830964305142685 Why is that? How can I have a hash function which will give me same results across different platforms (Windows, Linux, Mac)?

    Read the article

< Previous Page | 110 111 112 113 114 115 116 117 118 119 120 121  | Next Page >