Search Results

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

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

  • doing arithmetic upto two significant figures in Python?

    - by user248237
    I have two floats in Python that I'd like to subtract, i.e. v1 = float(value1) v2 = float(value2) diff = v1 - v2 I want "diff" to be computed upto two significant figures, that is compute it using %.2f of v1 and %.2f of v2. How can I do this? I know how to print v1 and v2 up to two decimals, but not how to do arithmetic like that. thanks.

    Read the article

  • [python] traversing an object tree

    - by jml
    Hi there, I'm trying to find information on different ways to traverse an object tree in python. I don't know much about the language in general yet, so any suggestions/techniques would be welcome. Thanks so much jml

    Read the article

  • Cross platform /dev/null in Python

    - by Tristan
    I'm using the following code to hide stderr on Linux/OSX for a Python library I do not control that writes to stderr by default: f = open("/dev/null","w") zookeeper.set_log_stream(f) Is there an easy cross platform alternative to /dev/null? Ideally it would not consume memory since this is a long running process.

    Read the article

  • using wild card when listing directories in python

    - by user248237
    how can I use wild cars like '*' when getting a list of files inside a directory in Python? for example, I want something like: os.listdir('foo/*bar*/*.txt') which would return a list of all the files ending in .txt in directories that have bar in their name inside of the foo parent directory. how can I do this? thanks.

    Read the article

  • Finding unique maximum values in a list using python

    - by mikip
    Hi I have a list of points as shown below points=[ [x0,y0,v0], [x1,y1,v1], [x2,y2,v2].......... [xn,yn,vn]] Some of the points have duplicate x,y values. What I want to do is to extract the unique maximum value x,y points For example, if I have points [1,2,5] [1,1,3] [1,2,7] [1,7,3] I would like to obtain the list [1,1,3] [1,2,7] [1,7,3] How can I do this in python Thanks

    Read the article

  • Python new-style classes and __subclasses__ function

    - by Fraser Graham
    Can somebody explain to me why this works (in Python 2.5) : class Foo(object): pass class Bar(Foo): pass print(Foo.__subclasses__()) but this doesn't : class Foo(): pass class Bar(Foo): pass print(Foo.__subclasses__()) The latter returns "AttributeError: class Foo has no attribute '__subclasses__'" but i'm not sure why. I know this is related to old-style vs. new-style classes but i'm not clear on why that would make this functionality unavailable.

    Read the article

  • Emacs bulk indent for Python

    - by Vernon
    Working with Python in Emacs if I want to add a try/catch to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just find it is the best tool for working through ssh. I am using Emacs on the command line(Ubuntu), not as a gui, if that makes any difference.

    Read the article

  • Writing a file shredder in python or ruby?

    - by pmilb21
    In the effort to learn python and/or ruby, I was wondering how a file shredder would be implemented? I would like it to take in a file as an argument and then employ an algorithm to make that file unrecoverable. Would possibly add the support for multiple files or even whole directories later.

    Read the article

  • Python multithreading, How is it using multiple Cores?

    - by Sabirul Mostofa
    I am running a multithreaded application(Python2.7.3) in a Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz. I thought it would be using only one core but using the "top" command I see that the python processes are constantly changing the core no. Enabling "SHOW THREADS" in the top command shows diffrent thread processes working on different cores. Can anyone please explain this? It is bothering me as I know from theory that multithreading is executed on a single core.

    Read the article

  • Safest python code running

    - by Oduvan
    How can I protect my web server, if I run custom users code on server. If any user can submit his python source on my server and run it. Maybe some modules or linux tools for close any network and hardware activity for this script. Thank's all for help!

    Read the article

  • How to make a simple clipboard monitor in python

    - by envy
    Hi! I was wondering how to make a simple Clipboard Monitor in python, for GUI I'm using PyGTK. I found gtk.clipboard class and all that but I couldn't find any solution to get the "signals" to trigger the event when the clipboard content has changed :( Any ideas? Thanks you! :)

    Read the article

  • Parsing timestamp with retarded Python

    - by jellybean
    I want to parse a timestamp from a log file that has been written via datetime.datetime.now().strftime('%Y%m%d%H%M%S') and then compute the number of seconds that have passed since this timestamp. I know I could do it with datetime.datetime.strptime to get back a datetime object and then compute a timedelta. Problem is, the strptime function has been introduced with Python 2.5 and I'm using Python2.4.4 (an upgrade is not possible in my context). Any easy way to do this?

    Read the article

  • Which logging library to use for cross-language (Java, C++, Python) system

    - by recipriversexclusion
    I have a system where a central Java controller launches analysis processes, which may be written in C++, Java, or Python (mostly they are C++). All these processes currently run on the same server. What are you suggestions to Create a central log to which all processes can write to What if in the future I push some processes to another server. How can I support distributed logging? Thanks!

    Read the article

  • How to create temporary files in memory visible for other process, using python

    - by LazyMiha
    Hello! I`m trying to write simple batch file generator in python. Batch file consist of about 30-50 lines of text and is passed to other applications. During the execution of script there a lot of calls to external applications. I want to create file in memory (like named pipes in win32). Is there any platform independ way? p.s. sorry for possible mistakes in text, I'm still learning English

    Read the article

  • Are classes in Python in different files?

    - by Asaf
    Much like Java (or php), I'm use to seperating the classes to files. Is it the same deal in Python? plus, how should I name the file? Lowercase like classname.py or the same like ClassName.py? Do I need to do something special if I want to create an object from this class or does the fact that it's in the same "project" (netbeans) makes it ok to create an object from it?

    Read the article

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