how to get files in a directory including all subdirectories
I am trying to get list all the log files (.log) in directory and included all subdirectories. Thanks in advance...... ...
I am trying to get list all the log files (.log) in directory and included all subdirectories. Thanks in advance...... ...
By using system command i want to open '.py' in the notepad. Ex assume i have "Fact.py" file. Now i want to write a program which will open this file in notepad and we can edit this file. ...
import sys print (sys.platform) print (2 ** 100) raw_input( ) I am using Python 3.1 and can't get the raw_input to "freeze" the dos pop-up. The book I'm reading is for 2.5 and I'm using 3.1 What should I do to fix this? Thanks. ...
import sys print (sys.platform) print (2 ** 100) input('press Enter to exit') Suppose I wanted to use the number 1 as the button that must be pressed to exit. How would I go about doing this? ...
What are the basic nuts and bolts of calling (running? interpreting? what can you do?) Python code from a Java program? Are there many ways to do it? ...
I'm suppose to capture everything inside a tag and the next lines after it, but it's suppose to stop the next time it meets a bracket. What am i doing wrong? import re #regex regex = re.compile(r""" ^ # Must start in a newline first \[\b(.*)\b\] # Get what's enclosed in brackets \n...
reading from serial port I get once a time lines of four types, let's call those A, B, C & D and put those values into accordion queue: now I have to write something like this: while readfromserial: if A: put A in queue1 elif B: save B elif C: B += C put B in queue1 B="" else: put in queue2 ...
I am using Python on Mac OSX Leopard. I am trying to run the program 'dot' (part of Graphviz) from Python: # -*- coding: utf-8 -*- import os print os.environ['PATH'] print os.system("ls >> a.txt") print os.system("dot -o9.png -Tpng ./6.dot") The command "ls" is there just to make sure that python is in the correct directory. It is. ...
How do you dynamically find out which functions have been defined from an instance of a class? For example: class A(object): def methodA(self, intA=1): pass def methodB(self, strB): pass a = A() Ideally I want to find out that the instance 'a' has methodA and methodB, and which arguments they take? ...
I'm looking for a python equivalent of ruby's halcyon - a framework focused on "web service"-type applications rather than html-page-oriented ones. Google brings up a lot of example code and experiments, but I couldn't find anything that people were using in production and hammering on. Failing that, what is the best web framework to us...
I am developing a vocabulary training program with Django (German-Swedish). The app's vocabulary data consists of a large number of "vocabulary cards", each of which contains one or more German words or terms that correspond to one or more Swedish terms. Training is only available for registered users, because the app keeps track of t...
How to identify whether a file is a normal file or a directory using python? thanks ...
I'm attempting to sort a list of strings in a locale-aware manner. I've used the Babel library for other i18n-related tasks, but it doesn't support sorting. Python's locale module provides a strcoll function, but requires the locale of the process to be set to the one I want to work with. Kind of a pain, but I can live with it. The p...
I am working on an a handler for the python logging module. That essentially logs to an oracle database. I am using cx_oracle, and something i don't know how to get is the column values when the table is empty. cursor.execute('select * from FOO') for row in cursor: # this is never executed because cursor has no rows print '%s\...
I am looking for a static analysis tool for Python, Ruby, Sql, Cobol, Perl, PL/SQL, SQL similar to find bugs and check style. I am looking for calculating the line count, identify bugs during the development, and enforcing coding standard. ...
Is it possible to create an attribute on a generator object? Here's a very simple example: def filter(x): for line in myContent: if line == x: yield x Now say I have a lot of these filter generator objects floating around... maybe some of them are anonymous... I want to go back later and interrogate them for w...
I successfully built and installed VTK-5.4 with Python bindings from source. Yet, when I try to import VTK in python it gives the following Traceback error File "", line 1, in File "/usr/local/lib/python2.6/dist-packages/VTK-5.4.2-py2.6.egg/vtk/init.py", line 41, in from common import * File "/usr/local/lib/p...
Hi guys, I have these files with the extension ".adc". They are simply raw data files. I can open them with Audacity using File->Import->Raw data with encoding "Signed 16 bit" and sample rate "16000 Khz". I would like to do the same with python. I think that audioop module is what I need, but I can't seem to find examples on how to us...
I have large chunks of data, normally at around 2000+ entries, but in this report we have the ability to look as far as we want so it could be up to 10,000 records The report is split up into: Two categories and then within each Category, we split by Currency so we have several sub categories within the list. My issue comes in efficien...
I'm using Python (Python 2.5.2 on Ubuntu 8.10) to parse JSON from (ASCII encoded) text files. When loading these files with json (simplejson), all my string values are cast to Unicode objects instead of string objects. The problem is, I have to use the data with some libraries that only accept string objects. Is it possible to get stri...