Search Results

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

Page 96/548 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • Python process will not exit

    - by oneself
    Hi, I'm use nosetests to run some tests. However, after the tests have finished running, the nosetests process just sits there, and will not exit. Is there anyway to diagnose this? Does Python have a facility similar to sending Java a kill -QUIT which will print a stack trace?

    Read the article

  • Converting a string into a list in Python

    - by Sam
    I have a text document that contains a list of numbers and I want to convert it to a list. Right now I can only get the entire list in the 0th entry of the list, but I want each number to be an element of a list. Does anyone know of an easy way to do this in Python? 1000 2000 3000 4000 to ['1000','2000','3000','4000']

    Read the article

  • String literals in python

    - by kjakeb
    Hello, Is there a way to declare a string variable in python such that everything inside of it is automatically escaped, or has its literal character value? I'm NOT asking how to escape the quotes with slashes, that's obvious. What I'm asking for is a general purpose way for making EVERYTHING in a string literal so that I don't have to manually go through and escape everything for very large strings. Anyone know of a solution? Thanks!

    Read the article

  • viewing files in python?

    - by Galilsnap
    I am creating a sort of "Command line" in Python. I already added a few functions, such as changing login/password, executing, etc., But is it possible to browse files in the directory that the main file is in with a command/module, or will I have to make the module myself and use the import command? Same thing with changing directories to view, too.

    Read the article

  • How does Python store lists internally?

    - by Mike Cooper
    How are lists in python stored internally? Is it an array? A linked list? Something else? Or does the interpreter guess at the right structure for each instance based on length, etc. If the question is implementation dependent, what about the classic CPython?

    Read the article

  • Why does this python code work?

    - by Int-0
    I have written a simple python module, it has this code: _log = logging.getLogger("mymodule") _started = False def set_log_level(level): _log.setLevel(level) if not _started: _hdlr = logging.FileHandler('mymodule.log') When I call set_log_level() program fails because symbol _started is not found. It is normal because global _started is missing in the method. But my question is: symbol _log has the same visibility as _started, so why does this symbol can be found? BR, // Toby

    Read the article

  • python tracing a segmentation fault

    - by pygabriel
    Hi, I'm developing C extensions from python ad I obtain some segfaults (inevitable during the development...). I'm searching a way to display at which line of code the segfault happens (an idea is like tracing every single line of code), how I can do that?

    Read the article

  • Pure python implementation of greenlet API

    - by Tristan
    The greenlet package is used by gevent and eventlet for asynchronous IO. It is written as a C-extension and therefore doesn't work with Jython or IronPython. If performance is of no concern, what is the easiest approach to implementing the greenlet API in pure Python. A simple example: def test1(): print 12 gr2.switch() print 34 def test2(): print 56 gr1.switch() print 78 gr1 = greenlet(test1) gr2 = greenlet(test2) gr1.switch() Should print 12, 56, 34 (and not 78).

    Read the article

  • python how to find the median of a list

    - by user3450574
    I'm trying to write a function named median that takes a list as an input and returns the median value of the list. I'm working with Python 2.7.2 The list can be of any size and the numbers are not guaranteed to be in any particular order. If the list contains an even number of elements, the function should return the average of the middle two. This is the code I'm starting with: def median(list): print(median([7,12,3,1,6,9]))

    Read the article

  • Clarification needed about Python CSV file format parsing

    - by HH
    Format is like: CHINA;2002-06-25 00:00:00.000;5,60 CHINA;2002-06-26 00:00:00.000;5,32 CHINA;2002-06-27 00:00:00.000;5,31 and I try to use Python's CSV tools to parse it but cannot understand the paragraph, source: And while the module doesn’t directly support parsing strings, it can easily be done: import csv for row in csv.reader(['one,two,three']): print row Could someone clarify the line ['one,two,three']? How would you use it with format A;B;C?

    Read the article

  • 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

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

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >