;>> open('./test')
>
> works just fine.
How doctored up is this example? In the above ./test should not
actually exist. Did the chdir actually work? Or did you remove
the .txt?
--
Micah Elliott | [EMAIL PROTECTED] | http://MicahElliott.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
On 2008-05-01 Ethan Furman wrote:
> I am trying to lock a file so no other process can get read nor
> write access to it.
This looks promising:
http://pypi.python.org/pypi/lockfile/0.2
--
Micah Elliott | [EMAIL PROTECTED] | http://MicahElliott.blogspot.com
signature.asc
Descr
platform. The biggest challenge might
be choosing which one to adopt:
http://wiki.python.org/moin/ConfigParserShootout
--
Micah Elliott | [EMAIL PROTECTED] | http://MicahElliott.blogspot.com
signature.asc
Description: Digital signature
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 28, 5:44 am, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Can you work on the topic and write a small howto for your wiki
> (http://wiki.python.org/moin/)?
Good idea. I've created a placeholder (with what I know so far, not
much) to track this:
http://wiki.python.org/moin/BuildStatica
On Dec 27, 8:32 am, Zentrader <[EMAIL PROTECTED]> wrote:
> I think you can just add -static to the gcc Flag line in the
> makefile.
Doing that (or CFLAGS=-static, or LDFLAGS=-static, or other Makefile
tweaks) gets me linker errors. Sounds like there's not a simple
prescribed means to do this (th
Are there instructions somewhere on how to build Python (on linux)
statically? This seems like a common thing to do want to do, but my
searching isn't turning up much. If it is common, it would be nice to
see a configure option like I've seen in other tools:
--enable-all-static Build compl
On Dec 02, Dave Hansen wrote:
> Python recognizes the TAB character as valid indentation. TAB
> characters are evil. They should be banned from Python source code.
AGREE! AGREE! AGREE!
> The interpreter should stop translation of code and throw an
> exception when one is encountered.
You co
On Dec 02, Joe Wong (Mango) wrote:
> Is this possible for a function to obtain its own name ?
>
>eg.
>def func1():
>print "my name is " + get_my_name()
>
>the result will show "my name is func1"
This very question was discussed recently:
http://groups.google.com/group/com
> Micah Elliott wrote:
> > On Nov 29, viewcharts wrote:
> >>I am reading two text files comparing the values in one to the other,
> >>this requires two loops.
> >
> > Or you could have a look at difflib.
> > http://docs.python.org/lib/differ-examples.
On Nov 30, Jürgen Kemeter wrote:
>My actual Problem:
>The Excel workbook contains several spreadsheets. These are
>linked through Hyperlinks, and contain several cell comments. How
>can I export these comments and Hyperlinks using Python?
Are you just wanting read a .xls file with
On Nov 29, viewcharts wrote:
> I am reading two text files comparing the values in one to the other,
> this requires two loops.
Or you could have a look at difflib.
http://docs.python.org/lib/differ-examples.html
--
_ _ ___
|V|icah |- lliott <>< [EMAIL PROTECTED]
"
On Nov 29, Fredrik Lundh wrote:
> inp = open("xyplan.nobreaks","r")
> data = inp.read()
>
> import textwrap
> for line in textwrap.wrap(data, 15):
> print line
Right -- if the data is that regular then every 15th item is the
split-point. A variation on this theme then is:
for i in range
On Nov 28, Anton81 wrote:
> I've written a python script and added short docstrings. Now I'd
> like to create a short overview of commands the user can use.
> However I don't want the internal stuff that I also commented. Is
> there a way to create a fancy documentation (e.g. pydoc) of certain
> fu
On Nov 22, Ben Bush wrote:
> I have a list:
> [[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
> How to remove all the duplicate or same after sorted from the lists?
> That is, [1,2] and [2,1] are the same after sorting them.
> I want the result to be:
> [[1,2],[3,1],[1,4],[3,3]]
You've described the code in
On Nov 19, Steven D'Aprano wrote:
> Perhaps Python should concatenate numeric literals at compile time:
>
> 123 456 is the same as 123456.
+1 for readability.
But in support of no change, When was the last time you looked at long
sequences of python digits outside of your editor/IDE? You probab
On Nov 21, David Isaac wrote:
> What's the good way to produce a cumulative sum?
>>> import operator
>>> x = 1,2,3
>>> reduce(operator.add, x)
6
--
_ _ ___
|V|icah |- lliott <>< [EMAIL PROTECTED]
" " """
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 19, Ben Finney wrote:
...
> This is just one of many reasons why I advocate always having a
> *single* return statement, at the *end* of the function.
Agreed that it's a good *general* practice, but sometimes early exit
is useful and clear.
This is somewhat of a religious topic. A goo
On Nov 18, Grant Edwards wrote:
> There is an NNTP patch to allow you to use mutt to read Usenet
> via an NNTP server.
Yes, I'm aware of it; it's last (alpha) update was in 1999 and
it probably has some fleas. :-)
> Mutt users who don't do that seem to like slrn -- it has a very
> similar look an
On Nov 18, [EMAIL PROTECTED] wrote:
> Grant> Obligatory aside: I'm completely baffled why anybody would choose
> Grant> the mailing list format over Usenet. I don't even read mailing
> Grant> lists via mailing lists. I recommend gmane.org's NNTP server for
> Grant> all your mailin
On Nov 17, Sinan Nalkaya wrote:
> how can i just get 1 character ? i`ve done a search but just found
> getch() for windows, i need same for unix and raw_input has any
> option that is not documented ?
Get all the characters one at a time:
>>> inp = raw_input('enter a string> ')
enter a st
On Nov 17, Ksenia Marasanova wrote:
> I have python2.3, installed from port /lang/python long time ago. The
> current version is 2.4, but I'd rather have two python versions,
> instead of upgrading.
> Is there maybe a way to somehow link installed python to
> /lang/python2.3 port, and then upgrade
On Nov 17, Duncan Booth wrote:
> Steven D'Aprano wrote:
> > What should I do when I can't rely on functions that
> > don't exist in older versions of Python?
> sys.exit('Archaic Python not supported, please upgrade')
+1 QOTW.
I recently gave up on trying to support (backport to) pre-2.2 i
On Nov 16, [EMAIL PROTECTED] wrote:
> Hi comp.lang.python:
> New to the group and new to python, so don't tear me up too much ...
> I installed the GNU readline support in python2.4, and it is working,
> but there is one annoying behaviour that I am hoping to squash ...
>
> Namely, when I hit to
On Nov 16, [EMAIL PROTECTED] wrote:
> I have a package directory structure as follows
>
> root-
> |
> Common (contains __init__.py file)
> WindowsComponents (contains __init__.py file)
> ...
>
> I would like modules in the WindowsComponents directory to be able
> to import some mo
On Nov 15, Gregory Piñero wrote:
>Hey guys, could anyone explain this behavior to me. It doesn't
>seem right :-(
>def testfunc(parm1,parm2={}):
>print 'parm2',parm2
>parm2['key1']=5
>>>testfunc('greg')
>parm2 {}
>>>testfunc('greg')
>parm2 {'key1': 5}
ht
On Nov 15, Jesse Rosenthal wrote:
> Whatever I do, though, I'll need to use pexpect to spawn the
> processes, since I'll need to log in to ssh servers with a password.
You might save yourself this effort by setting up ssh for
non-interactive use with keys instead of password authentication:
$
On Nov 14, striker wrote:
> I have a comma delimited text file that has multiple instances of
> multiple commas. Each file will contain approximatley 300 lines.
> For example:
>
> one, two, threefour,fivesix
> one, two, three,four,,eighteen, and so on.
>
> There is one time whe
On Nov 11, john boy wrote:
>I am running the following program from the example in "how to
>think like a computer scientist"
>...
>When I set "n"= 1000 the program runs in interpreter and stops
>counting down at 14 instead of running all the way to "Blastoff".
>Why is this
On Nov 10, [EMAIL PROTECTED] wrote:
> vim... I'll try to get it more polished/functional and put it up on
> sourceforge or somewhere.
Change "sourceforge or somewhere" to:
http://www.vim.org/scripts/add_script.php
--
_ _ ___
|V|icah |- lliott http://micah.elliott.name [EMAIL PROTECTED]
" "
On Nov 09, Christoph Haas wrote:
> I'm an addicted vim user and don't really use the IDLE for anything
> more than calculations where I'm too lazy to start KCalc. But one
> feature is very pretty: the built-in help for function calls while
> you type. Like you enter...
>
> var1,var2=mystring.split
On Nov 09, Dennis Benzinger wrote:
> Use the re module:
>
> import re
> your_data = """person number 1
>
> Name: bob
> Age: 50
>
>
> person number 2
>
> Name: jim
> Age: 39"""
>
> names = []
> for match in re.finditer("Name:(.*)", your_data):
> names.append(match.group(1))
> print names
[EMAIL PROTECTED] wrote:
> What do you use in your dairy work with python?
Cows hate snakes!
> which feature of python do you like most?
Various success stories:
http://pythonology.org/success
Eric Raymond:
http://pythonology.org/success&story=esr
Bruce Eckel:
http://www.artima.com/intv/aboutm
On Nov 01, Dudu Figueiredo wrote:
> I wrote a simpler script based in Micah Elliott's help...
I expanded my code from this thread to be a Cookbook recipe. It has
no specificity for MP3 renaming, but is generic to files with
shell-unfriendly names. It should usable as-posted if anyone needs to
cl
On Nov 01, Mike Meyer wrote:
> Kristina Kudriaðova <[EMAIL PROTECTED]> writes:
>
> > 1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> >> Hi, I have a file with this content:
> >>
> >> z zzz z
> >> ...
> >> xxx xx x 34.215
> >> zzz zz
> >> ..
On Nov 01, CppNewB wrote:
> First comment; "I hope the language is designed better than the
> site." The site is readable, but is amateurish.
That's flaim bait if I ever saw it!
I find the site quite lovely: very readable, no ads, well organized,
nice colors, simple, easy to maintain (uses ht2ht
On Nov 01, Karlo Lozovina wrote:
> I've been Googling around for _small_, flat file (no server
> processes), SQL-like database which can be easily access from
> Python. Speed and perforamnce are of no issue, most important is
> that all data is contained within single file and no server binary
> ha
Maciej Dziardziel wrote:
> > ...there is a group of path related functions in os.path (or
> > ntpath), including expanduser, and its better to use function...
On Nov 01, [EMAIL PROTECTED] wrote:
> Having a function is definitely cleaner. Creating a HOME environment
> variable where one does not ex
On Oct 31, Micah Elliott wrote:
> Now I need to go beautify my collection. :-)
While a fun exercise, there are probably already dozens (or
thousands?) of utilities in existence that do this and much more.
--
_ _ ___
|V|icah |- lliott http://micah.elliott.name [EMAIL PROTEC
On Oct 31, [EMAIL PROTECTED] wrote:
> but my focus is to learn how to acess a folder and rename all files in
> this folder.
This is a little more flexible than my last post, and it does the
whole job::
#! /usr/bin/env python
import glob, os, string
def fix_ugly_song_names(songdir, b
On Oct 31, [EMAIL PROTECTED] wrote:
> ...
> obs: the file names came this way(with spaces or apostrophes) from
> the cd i imported.
So remove them first. Here's a possible solution::
#! /usr/bin/env python
import glob, os.path
uglies = glob.glob("*.mp3")
print 'uglies:', uglies
On Oct 31, [EMAIL PROTECTED] wrote:
> I have one folder containing mp3 files, the folder is:
> C:\My Shared Folder\Rubber Soul
>
> And the files are:
> 03 you won't see me.mp3
> .
>
> I'm trying to rename files to:
> The Beatles - You Won't See Me.mp3
> .
My first suggestion is that you make bet
On Oct 27, Gregory Piñero wrote:
>
>my goal really was to do:
>try:something(1);except:pass
>try:something(2);except:pass
>try:something(3);except:pass
>...
>for about 20 lines.
If you just want to ignore the exceptions while saving space/typing,
you could equivalently do:
On Oct 25, RickMuller wrote:
> I really appreciate the ease that the distutils make distributing
> Python modules. However, I have a question about using them to
> distribute non-Python (i.e. text) data files that support Python
> modules.
It's not clear from your questions whether this is user-co
On Oct 26, John Salerno wrote:
> Hi all. I'm fairly new to programming and I thought I'd like to try
> Python. I'm trying to decide between these two books:
>
> Learning Python (O'Reilly)
> Beginning Python: From Novice to Professional (APress)
Consider first reading the tutorial. If you prefer
On Oct 21, Grant Edwards wrote:
> I'm guessing you're using Windows based on the question.
+1 QOTW.
--
_ _ ___
|V|icah |- lliott http://micah.elliott.name [EMAIL PROTECTED]
" " """
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 20, [EMAIL PROTECTED] wrote:
> I am looking for the best and efficient way to replace the first word
> in a str, like this:
> "aa to become" -> "/aa/ to become"
> I know I can use spilt and than join them
> but I can also use regular expressions
> and I sure there is a lot ways, but I need r
On Oct 19, Jarek Zgoda wrote:
> Micah Elliott napisał(a):
>
> >>How to install this structure eg. on Linux? What layout do you
> >>recommend? It's tempting to use /opt hierarchy for installation
> >>target (as it gives relatively much freedom withi
On Oct 19, Jarek Zgoda wrote:
> How to install this structure eg. on Linux? What layout do you
> recommend? It's tempting to use /opt hierarchy for installation
> target (as it gives relatively much freedom within application
> directory), but many administrators are reluctant to use this
> hierarc
On Oct 19, Sean Berry wrote:
> I am using MySQLdb to connect to a database and retrieve a timestamp
> from a table. The problem is I want the timestamp as a long,
> unformatted and all.
>
> In the table I have a timestamp like this
> 20051019111617
>
> But, when I retrieve the value and print it
On Oct 19, Daniel Sch�le wrote:
> I have one format with this structure
>
> A {
> x=1
> y=3
> B {
> z = "something here"
> }
> }
>
> C {
> }
>
> A {
> x=0
> y=0
> B {
> z = "other"
> }
> }
>
>
On Oct 20, Steven D'Aprano wrote:
> That's not what I get. What are you using?
>
> py> pprint.pprint([1,2,3,4,[0,1,2], 5], width=1, indent=4)
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: pprint() got an unexpected keyword argument 'width'
I find it useful to have al
On Oct 19, Chris Lasher wrote:
> Where do you guys go to learn all the capabilities of Vim? Just
> browsing through vim.org?
Just type:
:h
to see extensive info from the "User Manual", "Reference Manual", and
any plugins.
The near-comprehensive doc list:
http://vimdoc.sourceforge.net/
I don
rk/exec sleep10.sh, make it a group leader, and the
parent would kill its group.
Is there any way to enable Python's subprocess module to do (implicit?)
group setup to ease killing of all children? If not, is it a reasonable
RFE?
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
df")
>>> p
>>> df_out = p.read()
>>> p.close()
>>> p
>>> print df_out
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
fine control), etc.
* A PEP describing the conventions (though some will argue that PEPs
should be enforcable by the compiler, so maybe just a "Cheesecake
Convention" document).
* And of course anything that CPANTS offers :-)
I'm sure people here have more ideas for quality indicators...
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
that comes to my mind is
docutils <http://docutils.sourceforge.net/>.
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
uch more common to use Python's profiling facilities to
"profile a Python program". So if you really want to profile the
interpreter running your modules, then go ahead with gprof and follow
Jeff's advice; otherwise see
<http://www.python.org/doc/2.4.2/lib/profile.html>.
.org/pipermail/python-list/2003-May/165908.html
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
ware.
For programming language identifiers I wouldn't think that unicode
should be an issue. Sorry I'm no help with unicode specifics.
Some useful links:
http://www.python.org/doc/2.4.2/lib/module-re.html
http://www.amk.ca/python/howto/regex/regex.html
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
/bin/python" the same? If
not, it appears that "which python" can see cx_Oracle, but the latter
cannot. You could mess with PYTHONPATH or get /home/.../python into the
front of your PATH.
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
sibility of Eclipse becoming anywhere near standard, given any amount
of time.
I would suspect that the majority of Python programmers write in one of
vim or emacs. Anyone got stats?
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
;rnum=17&hl=en#c6fcc1afbd7c41b0
It might be nice to have an autoconf option to make this more obvious
for guys like us. Maybe this is just a rare need.
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
lt;http://docutils.sourceforge.net/rst.html> and it's own markup (epytext,
I think). RST is the de-facto Python markup, AFAICT. You'll need
something like "__docformat__ = 'restructuredtext'" in your modules.
RST is great for non-Python-source code, too.
Those a
I felt a bit
> lacking from the Python site, it seems it was only made for those
> who installed the source distribution, as for the other people...
> Anyways, thanks for the help!
I have no experience with this, but I see that Alex Martelli's "Python
In A Nutshell" has quite a
ave a colorized version of your "IDE" display.
--
Micah Elliott
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 04, Micah Elliott wrote:
>$ man 3 fnmatch
Actually "man 7 glob" would be better (assuming you've got *nix). Also
note that globs are not regular expressions. "pydoc glob" is another
reference.
--
Micah Elliott
--
http://mail.python.org/mailman/listinfo/python-list
t
$ python -c '
- import glob
- print glob.glob("[uU][nN][qQ]*.dat")
- '
['unq1.dat', 'UnQ1.dat', 'unQ1.dat', 'UNQ1.dat']
$ man 3 fnmatch
--
Micah Elliott
--
http://mail.python.org/mailman/listinfo/python-list
resorting to using if statements?
Optik (optparse) adheres to a "Tao of Option Parsing"
<http://optik.sourceforge.net/doc/1.5/tao.html>, which discusses
required option arguments.
--
Micah Elliott
--
http://mail.python.org/mailman/listinfo/python-list
tools won't be used until programmers have
means/motivation to use them, a pep.
But now that I have your feedback/ideas I (and maybe the lint folks)
can do better job of expanding flexible tools that can prove this
paradigm useful (or useless).
I will continue development on the tools and encourage anyone
interested in using a standard set of codetags for documentation and
tracking purposes to give them a try (and provide more feedback!) as
they mature.
--
Micah Elliott
--
http://mail.python.org/mailman/listinfo/python-list
Please read/comment/vote. This circulated as a pre-PEP proposal
submitted to c.l.py on August 10, but has changed quite a bit since
then. I'm reposting this since it is now "Open (under consideration)"
at <http://www.python.org/peps/pep-0350.html>.
Thanks!
--
Micah Elli
using `WikiRestructuredText`:trac:.
===
Codetag PEP (*or* Tao of Codetagging)
===
PEP: XXX
Title: Codetags
Version: $Revision$
Last-Modified: $Date$
Author: Micah Elliott
Status: Active
Type: Informational
Content-Type: text
71 matches
Mail list logo