text stringlengths 200 200k | source stringclasses 2
values |
|---|---|
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# Why does Python pep-8 strongly recommend spaces over tabs for indentation?
## Question
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain.
Is there an underlying reason fo... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
i... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
u... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
H... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
R... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
B... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
J... | stackoverflow-qa |
# How can I normalize a URL in python
## Question
I'd like to know do I normalize a URL in python.
For example, If I have a url string like : "http://www.example.com/foo goo/bar.html"
I need a library in python that will transform the extra space (or any other non normalized character) to a proper URL.
## Answer
I... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# Accessing object memory address
## Question
When you call the object.__repr__() method in python you get something like this back: <__main__.Test object at 0x2aba1c0cf890>, is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it... | stackoverflow-qa |
# How do I include a stacktrace in my Django 500.html page?
## Question
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False.
With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-an... | stackoverflow-qa |
# How do I include a stacktrace in my Django 500.html page?
## Question
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False.
With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-an... | stackoverflow-qa |
# How do I include a stacktrace in my Django 500.html page?
## Question
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False.
With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-an... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do I write this in Ruby/Python? Or, can you translate my LINQ to Ruby/Python?
## Question
Yesterday, I asked this question and never really got an answer I was really happy with. I really would like to know how to generate a list of N unique random numbers using a functional language such as Ruby without having ... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do you translate this regular-expression idiom from Perl into Python?
## Question
I switched from Perl to Python about a year ago and haven't looked back. There is only one idiom that I've ever found I can do more easily in Perl than in Python:
if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
From "How to Install Django" documentation (though this is useful to more than just Django installation) - execute the following from the shell:
python -c "from distutils... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
from distutils.sysconfig import get_python_lib
print get_python_lib()
Tags: python, installation | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
As others have noted, distutils.sysconfig has the relevant settings:
import distutils.sysconfig
print distutils.sysconfig.get_python_lib()
...though the default site.py... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
An additional note to the get_python_lib function mentioned already: on some platforms different directories are used for platform specific modules (eg: modules that requi... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
A side-note: The proposed solution (distutils.sysconfig.get_python_lib()) does not work when there is more than one site-packages directory (as recommended by this article... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
For Ubuntu,
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
...is not correct.
It will point you to /usr/lib/pythonX.X/dist-packages... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
Let's say you have installed the package 'django'. import it and type in dir(django). It will show you, all the functions and attributes with that module. Type in the pyth... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
All the answers (or: the same answer repeated over and over) are inadequate. What you want to do is this:
from setuptools.command.easy_install import easy_install
class e... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
This works for me.
It will get you both dist-packages and site-packages folders.
If the folder is not on Python's path, it won't be
doing you much good anyway.
import sys... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
This is what worked for me:
python -m site --user-site
Tags: python, installation | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
>>> import site; site.getsitepackages()
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
(or just first item with site.getsitepackages()[0]... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
The native system packages installed with python installation can be found at :
/usr/lib/python2.7/dist-packages/
by using this small code :
from distutils.sysconfi... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
This should work on all distributions in and out of virtual environment due to it's "low-tech" nature. The os module always resides in the parent directory of 'site-packag... | stackoverflow-qa |
# How do I find the location of my Python site-packages directory?
## Question
How do I find the location of my site-packages directory?
## Answer
Answer to old question. But use ipython for this.
pip install ipython
ipython
import imaplib
imaplib?
This will give the following output about imaplib package -
Typ... | stackoverflow-qa |
# Is there an Eclipse add-on to build a python executable for distribution?
## Question
I want to build an executable to distribute to people without python installed on their machines.
Is there an add-on to Eclipse that allows this? I couldn't find one.
If not, do you have a builder that you recommend that would ... | stackoverflow-qa |
# Is there an Eclipse add-on to build a python executable for distribution?
## Question
I want to build an executable to distribute to people without python installed on their machines.
Is there an add-on to Eclipse that allows this? I couldn't find one.
If not, do you have a builder that you recommend that would ... | stackoverflow-qa |
# Is there an Eclipse add-on to build a python executable for distribution?
## Question
I want to build an executable to distribute to people without python installed on their machines.
Is there an add-on to Eclipse that allows this? I couldn't find one.
If not, do you have a builder that you recommend that would ... | stackoverflow-qa |
# Need to create a layered dict from a flat one
## Question
I have a dict, that looks like this:
{
'foo': {
'opt1': 1,
'opt2': 2,
},
'foo/bar': {
'opt3': 3,
'opt4': 4,
},
'foo/bar/baz': {
'opt5': 5,
'opt6': 6,
}
}
And I need to ... | stackoverflow-qa |
# Need to create a layered dict from a flat one
## Question
I have a dict, that looks like this:
{
'foo': {
'opt1': 1,
'opt2': 2,
},
'foo/bar': {
'opt3': 3,
'opt4': 4,
},
'foo/bar/baz': {
'opt5': 5,
'opt6': 6,
}
}
And I need to ... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
shutil has many methods you can use. One of which is:
from shutil import copyfile
copyfile(src, dst)
Copy the contents of the file named src to a file named dst. The destination location must... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
Look at module shutil.
It contains function copyfile(src, dst)
Tags: python, filesystems | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
Use the shutil module.
copyfile(src, dst)
Copy the contents of the file named src to a file named dst. The destination location must be writable; otherwise, an IOError exception will be raised... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
import shutil
shutil.copy2('/dir/file.ext', '/new/dir/newname.ext')
or
shutil.copy2('/dir/file.ext', '/new/dir')
copy2 is also often useful, it preserves the original modification and access... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
Copying a file is a relatively straightforward operation as shown by the examples below, but you should instead use the shutil stdlib module for that.
def copyfileobj_example(source, dest, buffe... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
Directory and File copy example - From Tim Golden's Python Stuff:
http://timgolden.me.uk/python/win32_how_do_i/copy-a-file.html
import os
import shutil
import tempfile
filename1 = tempfile.mkt... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
You could use os.system('cp nameoffilegeneratedbyprogram /otherdirectory/')
or as I did it,
os.system('cp '+ rawfile + ' rawdata.dat')
where rawfile is the name that I had generated inside ... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
-------------------------------------------------------------------------
| Function |Copies Metadata|Copies Permissions|Can Specify Buffer|
---------------------------------------------... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
For large files, what I did was read the file line by line and read each line into an array. Then, once the array reached a certain size, append it to a new file.
for line in open("file.txt", "... | stackoverflow-qa |
# How do I copy a file in python?
## Question
How do I copy a file in Python? I couldn't find anything under os.
## Answer
from subprocess import call
call("cp -p <file> <file>", shell=True)
Tags: python, filesystems | stackoverflow-qa |
# Passing apache2 digest authentication information to a wsgi script run by mod_wsgi
## Question
I've got the directive
<VirtualHost *>
<Location />
AuthType Digest
AuthName "global"
AuthDigestDomain /
AuthUserFile /root/apache_users
<Limit GET>
Require valid-us... | stackoverflow-qa |
# Passing apache2 digest authentication information to a wsgi script run by mod_wsgi
## Question
I've got the directive
<VirtualHost *>
<Location />
AuthType Digest
AuthName "global"
AuthDigestDomain /
AuthUserFile /root/apache_users
<Limit GET>
Require valid-us... | stackoverflow-qa |
# How to get/set logical directory path in python
## Question
In python is it possible to get or set a logical directory (as opposed to an absolute one).
For example if I have:
/real/path/to/dir
and I have
/linked/path/to/dir
linked to the same directory.
using os.getcwd and os.chdir will always use the absolu... | stackoverflow-qa |
# How to get/set logical directory path in python
## Question
In python is it possible to get or set a logical directory (as opposed to an absolute one).
For example if I have:
/real/path/to/dir
and I have
/linked/path/to/dir
linked to the same directory.
using os.getcwd and os.chdir will always use the absolu... | stackoverflow-qa |
# Passing around urls between applications in the same project
## Question
I am trying to mock-up an API and am using separate apps within Django to represent different web services. I would like App A to take in a link that corresponds to App B and parse the json response.
Is there a way to dynamically construct th... | stackoverflow-qa |
# Passing around urls between applications in the same project
## Question
I am trying to mock-up an API and am using separate apps within Django to represent different web services. I would like App A to take in a link that corresponds to App B and parse the json response.
Is there a way to dynamically construct th... | stackoverflow-qa |
# Comparison of Python and Perl solutions to Wide Finder challenge
## Question
I'd be very grateful if you could compare the winning OâRourke's Perl solution to Lundh's Python solution, as I don't know Perl good enough to understand what's going on there. More specifically I'd like to know what gave Perl version 3x ... | stackoverflow-qa |
# Comparison of Python and Perl solutions to Wide Finder challenge
## Question
I'd be very grateful if you could compare the winning OâRourke's Perl solution to Lundh's Python solution, as I don't know Perl good enough to understand what's going on there. More specifically I'd like to know what gave Perl version 3x ... | stackoverflow-qa |
# Comparison of Python and Perl solutions to Wide Finder challenge
## Question
I'd be very grateful if you could compare the winning OâRourke's Perl solution to Lundh's Python solution, as I don't know Perl good enough to understand what's going on there. More specifically I'd like to know what gave Perl version 3x ... | stackoverflow-qa |
# Comparison of Python and Perl solutions to Wide Finder challenge
## Question
I'd be very grateful if you could compare the winning OâRourke's Perl solution to Lundh's Python solution, as I don't know Perl good enough to understand what's going on there. More specifically I'd like to know what gave Perl version 3x ... | stackoverflow-qa |
# What is the intended use of the DEFAULT section in config files used by ConfigParser?
## Question
I've used ConfigParser for quite a while for simple configs. One thing that's bugged me for a long time is the DEFAULT section. I'm not really sure what's an appropriate use. I've read the documentation, but I would rea... | stackoverflow-qa |
# What is the easiest, most concise way to make selected attributes in an instance be readonly?
## Question
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods o... | stackoverflow-qa |
# What is the easiest, most concise way to make selected attributes in an instance be readonly?
## Question
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods o... | stackoverflow-qa |
# What is the easiest, most concise way to make selected attributes in an instance be readonly?
## Question
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods o... | stackoverflow-qa |
# What is the easiest, most concise way to make selected attributes in an instance be readonly?
## Question
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods o... | stackoverflow-qa |
# Adding New Element to Text Substring
## Question
Say I have the following string:
"I am the most foo h4ck3r ever!!"
I'm trying to write a makeSpecial(foo) function where the foo substring would be wrapped in a new span element, resulting in:
"I am the most <span class="special">foo></span> h4ck3r ever!!"
Beaut... | stackoverflow-qa |
# Adding New Element to Text Substring
## Question
Say I have the following string:
"I am the most foo h4ck3r ever!!"
I'm trying to write a makeSpecial(foo) function where the foo substring would be wrapped in a new span element, resulting in:
"I am the most <span class="special">foo></span> h4ck3r ever!!"
Beaut... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
Take a look at how the doc format works and create word document using PHP in linux. The f... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
I'm not sure if you're going to have much luck without using COM. The .doc format is ridic... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
OpenOffice.org can be scripted with Python: see here.
Since OOo can load most MS Word fil... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
You could make a subprocess call to antiword. Antiword is a linux commandline utility for... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
I know this is an old question, but I was recently trying to find a way to extract text fr... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
(Note: I posted this on this question as well, but it seems relevant here, so please excus... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
If your intention is to use purely python modules without calling a subprocess, you can us... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
benjamin's answer is a pretty good one. I have just consolidated...
import zipfile, re
... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
Use the native Python docx module. Here's how to extract all the text from a doc:
documen... | stackoverflow-qa |
# extracting text from MS word files in python
## Question
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?
## Answer
Unoconv might also be a good alternative: http://linux.die.net/man/1/unoconv
Tags: python... | stackoverflow-qa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.