text
stringlengths
200
200k
source
stringclasses
2 values
# Iron python, beautiful soup, win32 app ## Question Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? ## Answer Regarding the second part of your q...
stackoverflow-qa
# Iron python, beautiful soup, win32 app ## Question Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? ## Answer Also, regarding one of the previous...
stackoverflow-qa
# Iron python, beautiful soup, win32 app ## Question Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? ## Answer I was asking myself this same quest...
stackoverflow-qa
# Iron python, beautiful soup, win32 app ## Question Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? ## Answer We are distributing a 40k line Iron...
stackoverflow-qa
# Iron python, beautiful soup, win32 app ## Question Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? ## Answer Seems to work just fine with IronPy...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer I have both installed: $ which python /usr/bin/python $ which python2.5 /opt/local/bin/python2.5 I also added the follo...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer Instead of uninstalling the built-in Python, install the MacPorts version and then modify your $PATH to have the MacPorts ...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer I wouldn't uninstall it since many scripts will expect python to be in the usual places when they do not follow conventio...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer Don't. Apple ships various system utilities that rely on the system Python (and particularly the Python "framework" build)...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer Use the python_select port to switch python interpreters. sudo port install python25 sudo port install python_select sudo...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer The current Macports installer does the .profile PATH modification automatically. Tags: python, osx, osx-leopard, macport...
stackoverflow-qa
# How do I uninstall python from OSX Leopard so that I can use the MacPorts version? ## Question I want to use the macports version of python instead of the one that comes with Leopard. ## Answer python_select is now deprecated, use this instead: sudo port select python python26 Tags: python, osx, osx-leopard, macp...
stackoverflow-qa
# Adding code to __init__.py ## Question I'm taking a look at how the model system in django works and I noticed something that I don't understand. I know that you create an empty __init__.py file to specify that the current directory is a package. And that you can set some variable in __init__.py so that import * w...
stackoverflow-qa
# Adding code to __init__.py ## Question I'm taking a look at how the model system in django works and I noticed something that I don't understand. I know that you create an empty __init__.py file to specify that the current directory is a package. And that you can set some variable in __init__.py so that import * w...
stackoverflow-qa
# Adding code to __init__.py ## Question I'm taking a look at how the model system in django works and I noticed something that I don't understand. I know that you create an empty __init__.py file to specify that the current directory is a package. And that you can set some variable in __init__.py so that import * w...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer Depends on what you will use it for. If you're making enterprise Windows for...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer Both are useful for different purposes. C# is a pretty good all-rounder, py...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer What's better is inherently subjective. If you like Python's syntax - learn ...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer Personally I feel you can write good/bad code in any language. I also firmly...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer It can't hurt to learn Python, especially considering some of the heavy weig...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer Yes, you should learn Python, but it has nothing to do with Python or C# bei...
stackoverflow-qa
# Is it good to switch from c# to python? ## Question Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better? ## Answer Never stop learning! That said, how can you compare the two? How good is P...
stackoverflow-qa
# time length of an mp3 file ## Question What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated) ## Answer You can use pymad. It's an external library, but don't fall for the Not Invented Here trap. Any particular reason ...
stackoverflow-qa
# time length of an mp3 file ## Question What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated) ## Answer Simple, parse MP3 binary blob to calculate something, in Python That sounds like a pretty tall order. I don't k...
stackoverflow-qa
# time length of an mp3 file ## Question What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated) ## Answer For google followers' sake, here are a few more external libs: mpg321 -t ffmpeg -i midentify (mplayer basically) ...
stackoverflow-qa
# time length of an mp3 file ## Question What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated) ## Answer Also take a look at audioread (some linux distros including ubuntu have packages), https://github.com/sampsyo/audior...
stackoverflow-qa
# time length of an mp3 file ## Question What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated) ## Answer simply use mutagen $pip install mutagen use it in python shell: from mutagen.mp3 import MP3 audio = MP3(file_pat...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Tabs versus spaces in Python programming ## Question I have always used tabs for indentation when I do Python programming. But then I came across a question here on SO where someone pointed out that most Python programmers use spaces instead of tabs to minimize editor-to-editor mistakes. How does that make a differ...
stackoverflow-qa
# Find matching sequences in two binary files ## Question Let me start off with a bit of background. This morning one of our users reported that Testuff's setup file has been reported as infected with a virus by the CA antivirus. Confident that this was a false positive, I looked on the web and found that users of an...
stackoverflow-qa
# Find matching sequences in two binary files ## Question Let me start off with a bit of background. This morning one of our users reported that Testuff's setup file has been reported as infected with a virus by the CA antivirus. Confident that this was a false positive, I looked on the web and found that users of an...
stackoverflow-qa
# Find matching sequences in two binary files ## Question Let me start off with a bit of background. This morning one of our users reported that Testuff's setup file has been reported as infected with a virus by the CA antivirus. Confident that this was a false positive, I looked on the web and found that users of an...
stackoverflow-qa
# Find matching sequences in two binary files ## Question Let me start off with a bit of background. This morning one of our users reported that Testuff's setup file has been reported as infected with a virus by the CA antivirus. Confident that this was a false positive, I looked on the web and found that users of an...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Parse DICOM files in native Python ## Question What is the simplest and most-pythonic way to parse a DICOM file? A native Python implementation without the use of non-Python libraries would be much preferred. DICOM is the standard file format in digital medical imaging (look here for more information). There are ...
stackoverflow-qa
# Using **kwargs with SimpleXMLRPCServer in python ## Question I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service = Service() server.register_instanc...
stackoverflow-qa
# Using **kwargs with SimpleXMLRPCServer in python ## Question I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service = Service() server.register_instanc...
stackoverflow-qa
# Using **kwargs with SimpleXMLRPCServer in python ## Question I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service = Service() server.register_instanc...
stackoverflow-qa
# Dynamically create variables inside function ## Question I want to create variables inside function from dictionary. Lets say I have a dictionary bar = {'a': 1, 'b': 2, 'c': 3} and function def foo(): pass What I want to do is to create inside function "foo" variables with names of each dictionary item name...
stackoverflow-qa
# Dynamically create variables inside function ## Question I want to create variables inside function from dictionary. Lets say I have a dictionary bar = {'a': 1, 'b': 2, 'c': 3} and function def foo(): pass What I want to do is to create inside function "foo" variables with names of each dictionary item name...
stackoverflow-qa
# Dynamically create variables inside function ## Question I want to create variables inside function from dictionary. Lets say I have a dictionary bar = {'a': 1, 'b': 2, 'c': 3} and function def foo(): pass What I want to do is to create inside function "foo" variables with names of each dictionary item name...
stackoverflow-qa
# Dynamically create variables inside function ## Question I want to create variables inside function from dictionary. Lets say I have a dictionary bar = {'a': 1, 'b': 2, 'c': 3} and function def foo(): pass What I want to do is to create inside function "foo" variables with names of each dictionary item name...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Fetch a Wikipedia article with Python ## Question I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedi...
stackoverflow-qa
# Short Integers in Python ## Question Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')? ## Answer ...
stackoverflow-qa
# Short Integers in Python ## Question Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')? ## Answer ...
stackoverflow-qa
# Short Integers in Python ## Question Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')? ## Answer ...
stackoverflow-qa
# Short Integers in Python ## Question Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')? ## Answer ...
stackoverflow-qa
# SVG rendering in a PyGame application ## Question In a pyGame application, I would like to render resolution-free GUI widgets described in SVG. What tool and/or library can I use to reach this goal ? (I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering) ## Answer You can use Cairo (...
stackoverflow-qa
# SVG rendering in a PyGame application ## Question In a pyGame application, I would like to render resolution-free GUI widgets described in SVG. What tool and/or library can I use to reach this goal ? (I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering) ## Answer I realise this does...
stackoverflow-qa
# SVG rendering in a PyGame application ## Question In a pyGame application, I would like to render resolution-free GUI widgets described in SVG. What tool and/or library can I use to reach this goal ? (I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering) ## Answer Cairo cannot render...
stackoverflow-qa
# SVG rendering in a PyGame application ## Question In a pyGame application, I would like to render resolution-free GUI widgets described in SVG. What tool and/or library can I use to reach this goal ? (I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering) ## Answer pygamesvg seems to ...
stackoverflow-qa
# SVG rendering in a PyGame application ## Question In a pyGame application, I would like to render resolution-free GUI widgets described in SVG. What tool and/or library can I use to reach this goal ? (I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering) ## Answer This is a complete ...
stackoverflow-qa
# SVG rendering in a PyGame application ## Question In a pyGame application, I would like to render resolution-free GUI widgets described in SVG. What tool and/or library can I use to reach this goal ? (I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering) ## Answer The last comment cr...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer You can use os.listdir(path) For reference and more os functions look here: Python 2 docs: https://docs.python.org/2/library/os.html#os.listdir Python 3 docs: https://docs.python...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer import os for filename in os.listdir("C:\\temp"): print filename Tags: python, filesystems
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer Try this: import os for top, dirs, files in os.walk('./'): for nm in files: print os.path.join(top, nm) Tags: python, filesystems
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer This is a way to traverse every file and directory in a directory tree: import os for dirname, dirnames, filenames in os.walk('.'): # print path to all subdirectories first. ...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer Here's a helper function I use quite often: import os def listdir_fullpath(d): return [os.path.join(d, f) for f in os.listdir(d)] Tags: python, filesystems
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer I wrote a long version, with all the options I might need: http://sam.nipl.net/code/python/find.py I guess it will fit here too: #!/usr/bin/env python import os import sys def ls(...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer If you need globbing abilities, there's a module for that as well. For example: import glob glob.glob('./[0-9].*') will return something like: ['./1.gif', './2.txt'] See the doc...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer A nice one liner to list only the files recursively. I used this in my setup.py package_data directive: import os [os.path.join(x[0],y) for x in os.walk('<some_directory>') for y i...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer A recursive implementation import os def scan_dir(dir): for name in os.listdir(dir): path = os.path.join(dir, name) if os.path.isfile(path): print pa...
stackoverflow-qa
# Directory listing in Python ## Question How do I get a list of all files (and directories) in a given directory in Python? ## Answer For files in current working directory without specifying a path: import os os.listdir(os.getcwd()) I still think this is quite clumsy, if anyone knows a shorter equivalent please ...
stackoverflow-qa
# Python subprocess issue with ampersands ## Question I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command ...
stackoverflow-qa
# Python subprocess issue with ampersands ## Question I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command ...
stackoverflow-qa
# Python subprocess issue with ampersands ## Question I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command ...
stackoverflow-qa
# Python subprocess issue with ampersands ## Question I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command ...
stackoverflow-qa