Search Results

Search found 13693 results on 548 pages for 'python metaprogramming'.

Page 93/548 | < Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >

  • Python equivalent of C++ getline()

    - by Arnab Sen Gupta
    In C++ we can enter multiple lines by giving our own choice of delimiting character in the getline() function.. however I am not able to do the same in Python!! it has only raw_input() and sys.stdin.readline() methods that read till I press enter. Is there any way to customize this so that I can specify my own delimiter?

    Read the article

  • Python style: multiple-line conditions in IFs

    - by Eli Bendersky
    Hello, Sometimes I break long conditions in IFs to several lines. The most obvious way to do this is: if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something Isn't very very appealing visually, because the action blends with the conditions. However, it is the natural way using correct Python indentation of 4 spaces. Edit: By the way, for the moment I'm using: if ( cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something Not very pretty, I know :-) Can you recommend an alternative way ?

    Read the article

  • how to delete lowercase words from a string in python

    - by gaggina
    I'm new in python and I'm having some issues doing a simple thing. I've an array (or list as it's said in pyton) like this: list = [ 'NICE dog' , 'blue FLOWER' , 'GOOD cat' , 'YELLOW caw'] As you see each element of this array contains some words. These words is both lowercase and uppercase. How I can delete from this array each lowercase words? For example I'd like to have as result this list: list = [ 'NICE' , 'FLOWER' , 'GOOD' , 'YELLOW']

    Read the article

  • Python integer incrementing with ++

    - by Znarkus
    I've always laughed to myself when I looked back at my VB6 days, "What modern language doesn't allow incrementing with double plus signs?": number++ To my surprise I can't find anything about this in the Python docs. Must I really subject myself to number = number + 1? Doesn't people use the ++/-- notation? :-(

    Read the article

  • Backup of folder + database - Python

    - by RadiantHex
    Hi there, I feel like this is quite delicate, I have various folders whith projects I would like to backup into a zip/tar file, but would like to avoid backing up files such as pyc files and temporary files. I also have a Postgres db I need to backup. Any tips for running this operation as a python script? Also, would there be anyway to stop the process from hogging resources in the process? Help would be very much appreciated.

    Read the article

  • POST request from Python to PHP

    - by RainbowHat
    Python params = urllib.parse.urlencode({'spam': '1', 'eggs': '2', 'bacon': '3'}) binary_data = params.encode('utf-8') reg = urllib.request.Request("http://www.abc.com/abc/smart/ap/request/",binary_data) reg.add_header('Content-Type','application/x-www-form-urlencoded') f = urllib.request.urlopen(reg) print(f.read()) PHP if($_SERVER['REQUEST_METHOD'] == 'POST') { //parse_str($_SERVER['QUERY_STRING']); var_dump($_SERVER['QUERY_STRING']); } When i try print binary_data , it does show the parameter but by the time it reaches the PHP , i see nothing. Any idea?

    Read the article

  • writing python to extract data from a file

    - by user297003
    Hi i am new to python i am trying to extract the text between that has specific text file ---- data1 data1 data1 extractme ---- data2 data2 data2 ---- data3 data3 extractme ---- and then dump it to text file so that ---- data1 data1 data1 extractme --- data3 data3 extractme --- thanks for the help data1 data1

    Read the article

  • Write easily readable XML in Python

    - by dutch
    Is there any way other than creating a method myself to write XML using python which are easily readable? xMLFile.write(xmlDom.toxml()) does create proper xml but reading them is pretty difficult. I tried toprettyxml but doesn't seem like it does much. e.g. following is what I would consider a human readable xml:

    Read the article

  • Automatically Generate a FlowChart in Python

    - by fayce
    Dear All, I would like to automatically generate a flowchart similar to this one ( http://en.wikipedia.org/wiki/File:%281%29_2008-04-07_Information_Management-_Help_Desk.jpg ) with Python. Do you have any advice regarding the library I should use to draw boxes, arrows (with the shortest path), text and some colors. Many thanks in advance !

    Read the article

  • Starting python debugger automatically on error

    - by jeremy
    This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered? I am not against having an extra import statement at the top of the file, nor a few extra lines of code.

    Read the article

  • Making Noise with Python

    - by Elliot
    I am trying to get python to make noise when certain things happen. Preferably, i would like to play music of some kind, however some kind of distinctive beeping would be sufficient, like an electronic timer going off. I have thus far only been able to make the system speaker chime using pywin32's Beep, however this simply does not have the volume for my application. Any ideas on how I can do this?

    Read the article

  • Bipartite matching in Python

    - by vailen
    Does anybody know any module in Python that computes the best bipartite matching? I have tried the following two: munkres hungarian However, in my case, I have to deal with non-complete graph (i.e., there might not be an edge between two nodes), and therefore, there might not be a match if the node has no edge. The above two packages seem not to be able to deal with this. Any advice?

    Read the article

  • Python unhash value

    - by blah01
    Hi all I am a newbie to the python. Can I unhash, or rather how can I unhash a value. I am using std hash() function. What I would like to do is to first hash a value send it somewhere and then unhash it as such: #process X hashedVal = hash(someVal) #send n receive in process Y someVal = unhash(hashedVal) #for example print it print someVal Thx in advance

    Read the article

  • Go through a number of functions in Python

    - by Asaf
    I have an unknown number of functions in my python script (well, it is known, but not constant) that start with site_... I was wondering if there's a way to go through all of these functions in some main function that calls for them. something like: foreach function_that_has_site_ as coolfunc if coolfunc(blabla,yada) == true: return coolfunc(blabla,yada) so it would go through them all until it gets something that's true. thanks!

    Read the article

  • Newbie : installing and upgrading python module.

    - by iamgopal
    I have downloaded and install a python library, via setup.py , python2.5 setup.py install ... now the version is changed at the source . a newer library is available. originally , i have clone it via mercurial, and install it. right now , i have updated repository. how do i use the newer version ? overwrite the installation ? by simply doing setup.py install again ?

    Read the article

< Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >