Search Results

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

Page 100/548 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • Python bitoperators

    - by Neelima
    What do the bit operators like AND(&),OR(|),XOR(^) in python do behind the screen? What do they calculate? I cannot understand the results they give when used in a program? 30&45 yields 12. How can we relate these three? 30|45 yields 63. How are these three related? Please answer this...

    Read the article

  • Find all occurrences of a substring in Python

    - by cru3l
    Python has string.find() and string.rfind() to get the index of a substring in string. I wonder, maybe there is something like string.find_all() which can return all founded indexes (not only first from beginning or first from end)? For example: string = "test test test test" print string.find('test') # 0 print string.rfind('test') # 15 #that's the goal print string.find_all('test') # [0,5,10,15]

    Read the article

  • python: list manipulation

    - by Jason S
    I have a list L of objects (for what it's worth this is in scons). I would like to create two lists L1 and L2 where L1 is L with an item I1 appended, and L2 is L with an item I2 appended. I would use append but that modifies the original list. How can I do this in Python? (sorry for the beginner question, I don't use the language much, just for scons)

    Read the article

  • 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.

    Read the article

  • What should I learn & use to become a pro in PHP & Python Web development?

    - by pecker
    Hello, I'll just show some code to show how I do web development in PHP. <html> <head> <title>Example #3 TDavid's Very First PHP Script ever!</title> </head> <? print(Date("m/j/y")); require_once("somefile.php"); $mysql_db = "DATABASE NAME"; $mysql_user = "YOUR MYSQL USERNAME"; $mysql_pass = "YOUR MYSQL PASSWORD"; $mysql_link = mysql_connect("localhost", $mysql_user, $mysql_pass); mysql_select_db($mysql_db, $mysql_link); $result = mysql_query("SELECT impressions from tds_counter where COUNT_ID='$cid'", $mysql_link); if(mysql_num_rows($result)) { mysql_query("UPDATE tds_counter set impressions=impressions+1 where COUNT_ID='$cid'", $mysql_link); $row = mysql_fetch_row($result); if(!$inv) { print("$row[0]"); } } ?> <body> </body> </html> Thats it. I write every file like this. Recently, I learnt OOP and started using classes & objects in PHP. I hear that there are many frameworks there for PHP. They say that one must use these libraries. But I feel they are just making things complicated. Anyway, this is how I've been doing my web development. Now, I want to improve this. and make it professional. Also I want to move to Python. I searched SO archives and found everyone suggesting Django. But, can any one give me some idea about how web development in Python works? user (client) request for page --- webserver(-embedded PHP interpreter) ---- Server side(PHP) Script --- MySQL Server. Now, is it that instead of PHP interpreter there is python interpreter & instead of php script there is python script, which contains both HTML & python (embedded in some kind of python tags). Python script connects to database server and fetches some data which will be printed as HTML. or is it different in python world? Is this Django thing like frameworks for PHP? Can't one code in python without using Django. Because, I never encountered any post without django Please give me some kick start.

    Read the article

  • Fast matrix transposition in Python

    - by psihodelia
    Is there any fast method to make a transposition of a rectangular 2D matrix in Python (non-involving any library import).? Say, if I have an array X=[[1,2,3], [4,5,6]] I need an array Y which should be a transposed version of X, so Y=[[1,4],[2,5],[3,6]].

    Read the article

  • NetBeans and Python

    - by spacemonkey
    When I run some python code in NetBeans, which raises an error, the output in NetBeans just gives an error message and no further information, such as line number. Is there any way to fix that?

    Read the article

  • Practicing BDD with python

    - by JtR
    Which are the most advanced frameworks and tools there are available for python for practicing Behavior Driven Development? Especially finding similar tools as rspec and mocha for ruby would be great.

    Read the article

  • Is there YAPE::Regex::Explain alternative to python?

    - by S.Mark
    Is there perl's YAPE::Regex::Explain alternative to python? Which could do \w+=\d+|\w+='[^']+' to explanations like this NODE EXPLANATION -------------------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- = '=' -------------------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- | OR -------------------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- =' '=\'' -------------------------------------------------------------------------------- [^']+ any character except: ''' (1 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- ' '\''

    Read the article

  • logarithms in python

    - by Srikanth
    write a program to find the sum of the logarithms of all the primes from 2 to some number n, and print out the sum of the logs of the primes, the number n, and the ratio of these two quantities in python

    Read the article

  • Python for loop question

    - by Joe Dunk
    I was wondering how to achieve the following in python: for( int i = 0; cond...; i++) if cond... i++; //to skip an run-through I tried this with no luck. for i in range(whatever): if cond... : i += 1

    Read the article

  • Python: Run a progess bar and work simultaneously?

    - by DanielTA
    I want to know how to run a progress bar and some other work simultaneously, then when the work is done, stop the progress bar in Python (2.7.x) import sys, time def progress_bar(): while True: for c in ['-','\\','|','/']: sys.stdout.write('\r' + "Working " + c) sys.stdout.flush() time.sleep(0.2) def work(): *doing hard work* How would I be able to do something like: progress_bar() #run in background? work() *stop progress bar* print "\nThe work is done!"

    Read the article

  • Using wget via Python

    - by CoreIs
    How would I download files (video) with Python using wget and save them locally? There will be a bunch of files, so how do I know that one file is downloaded so as to automatically start downloding another one? Thanks.

    Read the article

  • Rails and Python hosting problem

    - by maxxtack
    I am trying to host some files/rails app in the port 8080 for external access. For python I am using the SimpleHTTPServer module, and for rails, webrick. However, both of them does not work very well. I don't get the response back, and, sometimes, if I get it, it's VERY slow. Nevertheless, apache works very well on the port 8080 (i am not running them at the same time). What is going on?

    Read the article

  • How to reload python module from itself?

    - by mivulf
    I have a python module with a lot of variables. These variables are used and changed by many other modules. And I want to reload this module from itself when it happens (for refresh). How to do that? # ================================== # foo.py spam = 100 def set_spam(value): spam = value foo = reload(foo) # reload module from itself # ================================== # bar.py import foo print foo.spam # I expect 100 # assume that value changes here from some another modules (for example, from eggs.py, apple.py and fruit.py) foo.set_spam(200) print foo.spam # I expect 200

    Read the article

  • python script argument misinterpreted in Hudson Execute Shell step

    - by chz
    When I run my python script in the shell terminal, it works sudo myscript.py --version=22 --base=252 --hosts="{'hostA':[1],'hostB':[22]}" But when I run in Hudson and Jenkins, using Execute Shell step, somehow, the string --hosts="{'hostA':[1],'hostB':[22]}" is interpreted as sudo myscript.py --version=22 --base=252 '--hosts="{'hostA':[1],'hostB':[22]}"' How do we overcome this so that our script would run in Jenkins and Hudson ? Thank you. Sincerely

    Read the article

  • running a python script on a remote computer

    - by Richard
    Hello all, I have a python script and am wondering is there any way that I can ensure that the script run's continuously on a remote computer? Like for example, if the script crashes for whatever reason, is there a way to start it up automatically instead of having to remote desktop. Are there any other factors I have to be aware of? The script will be running on a window's machine.

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >