OkaMthembo schrieb:
> Indeed, using directories may be a better bet when there are many files
> involved. At least, this has been my feeling, and i gather the same from
> your replies.
I suggest that you take a look at a database abstraction layer or ORM like
SQLAlchemy [1], that makes handling th
Dhiraj Sharma schrieb:
> 1. Is it possible to cancel (kill) a "child" thread from the main thread
> in Python running on Windows?
If you have control over the code of the thread, it could periodically check
(in it's "run" method) an Event or Queue object, whether it should exit. See
http://www.pyt
Shitiz Bansal schrieb:
> I need to implement a system which stores Strings(average length 50 chars).
> I was wondering what would be the most efficient(timewise) solution for
> this riddle.
I'd use pysqlite, a SQL database in a file.
> For every input String it would need to tell the user wether
Vasile Filat schrieb:
> Help me please to correct my code which I will include below.
It is customary to include code examples either inline in your message or
attach them as a plain text source code file. Some mailing list frown on
attachments in general (but this one doesn't, to my knowledge), b
Hi all,
this is maybe more of a Linux question or about how Python plays together with
the OS:
I have a virtual server on which I installed Ubuntu Dapper LTS with a minimal
install plus the things I needed. If I do
from datetime import datetime
t = datetime.now()
there, 't' is a naive datetme o
Justin Ezequiel schrieb:
a = list('asdfg')
map(None, a[::2], a[1::2])
> [('a', 's'), ('d', 'f'), ('g', None)]
a = list('asdfgh')
map(None, a[::2], a[1::2])
> [('a', 's'), ('d', 'f'), ('g', 'h')]
That's clever! Thanks!
Chris
___
Tutor
David Perlman schrieb:
> I found this by "using Google". You should be able to make a simple
> modification (I can think of a couple of ways to do it) to have it
> pad the end with "None". It is 100% iterator input and output.
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/30327
Luke Paireepinart schrieb:
> Christopher Arndt wrote:
>> I have tried to find a solution, using itertools, but I'm not very
>> experienced in functional stuff, so I got confused.
> Do you mean you're not experienced in using functions or do you mean
> you
Given a sequence, how can I group it pairwise, so that I get
[(s0, s1), (s2, s3), ... , (sn-1, sn)]
or, if len(s)%2 != 0
[(s0, s1), (s2, s3), ... , (sn, None)]
I have tried to find a solution, using itertools, but I'm not very
experienced in functional stuff, so I got confused. There is a reci
Steve Nelson schrieb:
> I'd like some suggestions for a course outline - bear in mind I'll
> only have a day for the course. The attendees are all sysadmins with
> a UNIX background, and are reasonably comfortable with shell, but
> nothing else.
Must topics (apart from the basic Python stuff):
-
Hilton Garcia Fernandes schrieb:
> Dear all,
>
> i've been using doxygen for quite a time to document softwares written in
> C and C++, but could not found a similar tool for Python software.
>
> Could you please point me to a suitable tool ?
How about http://epydoc.sourceforge.net/ ?
Chris
___
Rikard Bosnjakovic schrieb:
> On 2/9/07, johnf <[EMAIL PROTECTED]> wrote:
>
>> Is there a Python tool/document that is similar? Just a simple way to help
>> understand.
>
> Yes, use the __doc__ property.
Which is made a lot easier by using the 'help' function in the interactive
interpreter:
>>
thomas coopman schrieb:
> I need a function that groups almost equal strings. It seems most easy
> to me, to do this with a hash function.
What do you mean be "almost equal"? By which criterium? Spelling,
Pronounciation? Semantics?
> I think I once read something about it, but I can't find it,
Vladimir Strycek schrieb:
> Hi all,
>
> Is it possible to do self modifing script ? I think like variables which
> are defined in the beginning of script could be modified by it self on
> the run... like saving setting but not to external file but directly to
> it self...
While what you propos
govind goyal schrieb:
> I want to write a Automated Scripts to configure my AP through HTTP.
> Can any body suggest basic coding for this?
Search the cheeseshop [1] for mechanoid and mechanize.
Chris
[1] http://cheeseshop.python.org/pypi/
___
Tutor ma
János Juhász schrieb:
> do you have any idea, how I can send a txt file to the default printer in
> landscape view with python on windows.
I assume that by "txt file", you mean a file containing ASCII text?
> I wanted to set up just the char size and the orientation of the printout.
Printers no
Magnus Wirström schrieb:
> Hi everyone
>
> I'm learning to program python with wxpython gui. I have a application i
> made with several modules and i want to implement a configfile that
> applies to all those modules. Is there an easy way to do this ? Can
> anyone point me in the right directi
Luke Paireepinart schrieb:
> I can think of a roundabout way to do what you want:
>
> PHP file returns a form to the client. when this form is submitted to
> the py file, all of the data your py script needs is sent in the query
> string or whatever.
> the py file does whatever it does, and the
Steve Nelson schrieb:
> I want to create a dictionary of files and md5sums for a given
> directory. It seems, however, that md5 works with strings or
> read-only buffers, and can't be passed a file.
>
> What I want to do is something like:
>
> for f is os.listdir("."):
> d[f] = someFunctionTha
sonia agarwal schrieb:
> I am trying to download files from a network element whose IP
> address,username and password is the only thing i know to establish an
> SFTP connection using python script.I have found that I need to use
> M2Crypto package which in turn requires openssl 0.9.7l or newer.
>
Barton David schrieb:
> I just can't wrap my head around stdin, stdout and the whole pipes
> thing, but there's got to be a relatively simple way to do this, surely?
You have to distinguish between three different concepts:
1) file names
2) file objects
3) file contents
1) Is just a string with
Luke Paireepinart schrieb:
> Just wondering -
> do you guys buy SMS messages or is there some way to communicate with
> text message users for free?
There are some providers that give you a certain amount of SMS per month for
free, even if you only have a prepaid SIM card. O2 Ireland is an exampl
shawn bright schrieb:
> lo there all.
>
> i am in a tight spot because i need to send an email that it mime
> encoded plain-text ( not html or anything )
>
> anyone know of a good tutorial or recipe out there ?
Simplified example from http://www.python.org/doc/current/lib/node162.html:
# Import
OkaMthembo schrieb:> i think id feel more confortable with a framework thatd
provide a basic
> MVC architecture and leave me to roll my own SQL etc, not one that will
> generate half a project for me.
With TurboGears you're not bound to SQLObject or SQLAlchemy. You can roll your
own database acces
[EMAIL PROTECTED] schrieb:
> I want to distribute the program once
> it's finished so it means explaining this (sudo bit) in the install
> instructions.
>
> Is this a good / bad way to achieve this?
Yes, the user should be always made aware, if he is to run something as root.
Requiring him to co
Kent Johnson schrieb:
> David wrote:
>> print “Hit heads”+” “+str(heads)+” “+”times”+” “ + “hit tails” + “
>> “+str(100-heads)+” “ + “times”
>
> This sounds a lot like homework [...]
An if you want to get extra marks for pythonicity ;-), read about string
formatting here:
http://www.python.org
OkaMthembo schrieb:
> this is my first post. please could you tell me which is the best
> lightweight python web framework?
"Web framework" and "lightweight" don't really go well together. There are so
many things about web programming that you don't realise you need when you
start, but *will* com
Simon Brunning schrieb:
> On 1/4/07, OkaMthembo <[EMAIL PROTECTED]> wrote:
>> also, which is the best templating
>> language for python? (which can handle other data formats in addition to
>> text). so far im lured by Cheetah, although i havent done any web dev with
>> python yet.
>
> Cheetah's go
Ketan Maheshwari schrieb:
> Is it possible to show this scenario as an animation sequence and
> capturing the coordinates of the centers of the circles at each step and
> stopping the iteration when they get tangential.
Have a look at the PyGame library: http://pygame.org
Don't be put off be th
Carlos schrieb:
> My problem is that no matter were I put this, I have to declare ga a
> global.
You are confusing two different objects with the name 'ga' here:
a) the module object 'ga' which you create by import ing it:
import ga
this binds the name 'ga' to the module object created by read
Toon Pieton schrieb:
> I'm trying to connect to a certain key in my registery using winreg.
> However, I have run into some problems.
>
> 1) I'm trying to open HKEY_CURRENT_USER\Softwar\PartyGaming\PartyPoker.
> Is this (see below) the correct way to open that key?
See here for some examples of u
shawn bright schrieb:
> ok,
> i am on ubuntu and there is no /etc/profile.d directory
> i put this in the /etc/environment file
>
> PYTHONPATH=/usr/lib/python2.4/site-packages/pivotrac
> export PYTHONPATH
>
> but it doesn't seem to be working.
> There is no master python config file somewhere whe
shawn bright schrieb:
> lo there,
>
> i am working with python in ubuntu, my app has some modules that i would
> like to import from anywhere.
> i can sys.path.append(my_module_dir)but it only lasts as long as
> that python session.
> how can i add a directory to the import path permantly
htt
Carlos schrieb:
> And if by chance you are familiar with genetic algorithms, well that
> would be perfect, because you can take a look at how I took a genetic
> algorithm python module and applied to my project.
I'm afraid that I don't have the domain specific knowledge to be of much help
here and
Jonathon Sisson schrieb:
> Christopher Arndt wrote:
>> P.S. This is basically just rephrasing what has been already said by others
>> and
>> better: http://www.catb.org/~esr/faqs/smart-questions.html
>
> Seriously, that is an excellent guide. Eric S. Raymond writes
Carlos schrieb:
> I don't know if this is a good thing to ask in this mailing list, or if
> it is possible for someone to take a look and spot my errors, but I
> really can't think of a better way.
It might be a better idea to ask for solutions or hints for a specific problem
or comments on a sp
Basil Shubin schrieb:
> I have read articles about MVC/MVP, but still can't get a clue to how
> implement it in really working application :-( Because I better
> understand with ready to use examples, can you provide link to free
> python+GUI application which implements MVC/MVP design?
The MVC
Christopher Arndt schrieb:
> Of course you have to do this before you (or some other code in your program)
> do anything siilar to os.chris('/somewhere/else').
^
That was some freudian slip of my narcissistic mind *LOL*
Of course, I mean:
os.chdir(
Jordan Greenberg schrieb:
> Slightly hackish and nasty, but seems to do the trick. Someone'll
> probably suggest a better way, this is just the first thing I could come
> up with:
No, IMHO it's perfectly normal and safe practice, though this gets the full
path name of the program. If you want the
[EMAIL PROTECTED] schrieb:
>
> Hi all,
>
> I have a python script (with endless loop) and i want to
> start it from the rc.config file. So, the question is: how
> to covert this script to work as daemon ... or how to start
> the python interpreter ... to work as background process ?
Search googl
Chris Hengge wrote:
> I have a script that makes my python scripts into .pyc files and I can
> run those without a .py in the directory or anywhere else on the system
> for that matter. No clever tricks needed.
You're right. Probably this trick was only needed in (very) old versions
of Python.
devayani barve schrieb:
> I have a table in hmtl and i want to write a program so that I
> can insert a column within it..
> Can someone tell me what to use . as in dom???
> Just want to know how to go about it!!!
What do you mean exactly? Do you want to manipulate the HTML document in the
bro
Addendum: these rules only apply to Python *modules*. AFAIK, when you call a
Python file as a script, no matching .pyc/.pyo file is used or generated.
There are some clever tricks to run a .pyc file as a script. I think it is
described in the Python CGI FAQ.
Chris
Chris Hengge schrieb:
> My understanding is that whenever you run a script that has a newer.py,
> the .py runs, otherwise it automagically will use the .pyc
Not exactly. Whenever there is a .py file and no .pyc file is present or the
.pyc file is older, Python will read the .py file, compile it in
[EMAIL PROTECTED] schrieb:
> I suppose there is a good way to do indent whole blocks like this, but I
> haven't found out what it is. Could anybody help me out?
Yes, get a good source code editor that has the ability to (de)indent whole
blocks of code with one keystroke. This is a must-have for w
(sorry, did only send this to the OP first, now re-sending to list)
Basil Shubin schrieb:
> Hi friends!
>
> Is there any extension or library to create/write data in OpenDocument
> Spreadsheet? I found pyExcelerator, but it's working only with xls format.
How about pyUno? http://udk.openoffice
Picio schrieb:
> Hello,
> Can you point me to some CRM and ERP software written in Python, that
> in your "guru" opinion is a good product? Maybe also Open Source?
Have you asked Google?
http://tinyerp.org/
Chris
___
Tutor maillist - Tutor@python.org
Todd Dahl schrieb:
> I am currently working on a project that in a small part of it I need to
> find keys in the windows registry. I have found _winreg but was
> wondering if anyone knows of any modules that people have written as a
> wrapper for it. I have googled like crazy but am not finding any
Antonios Katsikadamos schrieb:
> hi all folks. i am running python2.4 on suse linux and i would like to
> install the module mx.DateTime. does anyone know how i can install it?
If you want to install it from the source code, you need a C compiler and the
Python development package. I don't know ex
Asrarahmed Kadri schrieb:
> I want to install the SOAPpy module on my windows box. I have python
> 2.4.3
>
> Can you help me with the steps and the URL from where can I get the
> download..??
What have you tried so far? Did you google for "SOAPpy download"?
Are you experiencing any problems?
Chr
Eli Brosh schrieb:
> Hello.
> I am beginning to use python on windows.
> how can I add a path to Python search-list where I can store my python
> scripts ?
> On IDLE the command *browse path* lets me to see the existing path but
> not to edit it.
Hello,
you may be confusing* two different concept
Asrarahmed Kadri schrieb:
> I want to perform arithmetic operations on date supplied by the user on the
> command line.
>
> Is there any built-in utility for this..??
Not built-in, but very useful:
http://labix.org/python-dateutil
Chris
___
Tutor mail
John Fouhy schrieb:
> On 02/11/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
> myStr = "I want to strip my words."
> print myStr.strip("my")
> 'I want to strip words.'
>
> .strip() only removes text from the beginning and end of the string.
It is generally used to remove whitespace from
johnsonv3 schrieb:
> When one installs a program (such as Panda or Livewires) into python
> sitepackage folder is the python search path automnatically updated to
> search the newly installed folders and files?
Generally speaking, yes. The Python package (to use the proper name) either
needs to ha
johnsonv3 schrieb:
> If one does this...
>
> import sys
> sys.path.append("C:\\panda\direct")
>
> Is the change to python search path only temporary?
Yes, it only changes the search path within that program. The system-wide
default search path is not changed.
Chris
___
Tino Dai schrieb:
> I have a general question about programming. My program that I have
> been writing is fully modularized. My question is: Is there a
> programming technique that would alleviate the passing of a huge number
> of variables.
Yes, it's called "object-oriented programming" ;-)
Terry Carroll schrieb:
> You can just use a series of Queues, where each Queue represents the work
> being passed from one thread to the other.
If you want, you can have a look at my threadpool module, which implements
exactly this pattern. It is basically nothing more than an elaborate example o
Vlad Popescu schrieb:
> Hi there, everyone; first time poster! Sorry if this isn't very closely
> related to Python, but I have encountered the issue while trying to
> learn Python, so I guess I can just ask here.
>
> My question is: when invoking a program with, let's say, a filename
> containing
Basem Narmok schrieb:
> Hi all,
>
> I am planning to make a Python CD for advocating Python, and I need your
> suggestions about this, the objective is to build a CD that contains the
> basic material for Python beginner (e.g. Python 2.4.2 for different
> platforms) with some advocating materia
Paul Hendrick schrieb:
> Hi there,
> I've got a problem with getting the difference between 2 directories,
> but only recognising directories and not files.
> I'm trying to find directories in /home/svn that aren't
> in /usr/local/trac/projects.
>
> The list returned by listdir in /home/svn is:
>
Tim Johnson schrieb:
> The following code snippet is meant to test inheritance:
> class test:
> def __init__(self,v):
> self.__val = v
> def val(self):
> print self.__val
> class sub(test):
> def __init__(self):
> val()
> The following console session has an erro
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Johan Geldenhuys schrieb:
> This script was not intended to be used from the command line, but to
> be called from elsewhere. It was only a test piece of code.
> If you use the ping command with the args that you are calling it with,
> there is no nee
Johan Geldenhuys wrote:
> What is this line supposedto do?
>
> cmd.run('www.python.org')
Run the command that was defined at object creation ('ping -c 10') with
the argument 'www.python.org'.
Chris
___
Tutor maillist - Tutor@python.org
http://mail.py
allows to kill them after later..
::Author: Johan Geldenhuys
[EMAIL PROTECTED]
::Version: 0.0.2
::Date last updated: 2005-11-16
::Changes:
- refactored by Christopher Arndt
:: TODO: Capture the output from line 41 to a file.
"""
import os, signal, time
cl
Kent Johnson schrieb:
>>And somewhere docutils belongs on that list, but i don't know where. Maybe
>>source code documentation? But then you'd probably have to list epydoc,
>>gendoc,
>>etc. as well.
>
>
> I think this page will be more useful as a list of favorites or things that
> beginners mi
Alan Gauld schrieb:
> I've just added an incomplete draft copy of my latest tutorial topic
> on using the Operating System from Python. The material that's
> there discusses the role of the OS and looks at file handling
> usng os/os.path/shutil etc.
>
> http://www.freenetpages.co.uk/hp/alan.gauld
Ron Phillips schrieb:
> A wonderful idea! I have created a wiki page in Python.org with a list
>
> of such 'favourite' modules.
> Please take a look:
> http://wiki.python.org/moin/UsefulModules
Good idea! The GUI section might be problematic, though. I don't see that any
of the main GUI alternat
Python schrieb:
> The Python scripts are OK. The Perl scripts do not receive the POST
> parameters so they execute as though no parameters were supplied. I've
> added logic to display the environment and that appears (to my Python
> oriented eye) to be correct. In particular, the CONTENT_LENGTH
Shantanoo Mahajan schrieb:
> +++ Hugo Gonz?lez Monteverde [08-11-05 13:13 -0600]:
> | Hi Mike,
> |
> | Converting an (almost)arbitrary object into a string is what the Pickle
> module does. CPickle is faster. Take
> | a look into into it in the docs.
> |
>
> Is there a way to dump the varialbl
nephish schrieb:
> hey there gents,
> i am looking for a good place to start learning how to read a web page
> with python and pull out bits of information for an app i am doing for
> work. i have googled and looked at the docs. i looked at urllib and
> httplib so i think this a place to kind
Scott Oertel schrieb:
> I'm looking for an easy way to find the current directory location of my
> program so I can include the config.ini file correctly without having to
> pass command line args.
So, do you want to find out, where your script is living, or the directory from
which it was calle
Jay Loden schrieb:
> I can't figure out how one would approach this in Python (i'm using
> mod_python). There's no equivalent to the "include" function from PHP. I
> can't use import because then Python would try to parse the HTML from the
> imported file. I've looked at stuff like cheetah and P
Negroup - schrieb:
> Hi all, I have an xml file where the tags are all on the same line,
> without any newline. This file is quite big and difficult to read. I'd
> like to format it in a convenient way, using indentation and nesting.
> How to pretty print my content?
Untested:
import sys
from xml
Bernard Lebel schrieb:
> Hello,
>
> Let say I have a string. The value of the string might be 'False',
> 'True', '3', '1.394', or whatever else. Is there a quick way to
> convert this string into the appropriate data type other than with
> try/except?
A quick way, yes. But also secure? No.
>>> l
Chris Hallman schrieb:
> for i in passwordlist:
> if i == port:
> os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet " + sys.argv[1] +
> " " + sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4])
1) The last line can be also expressed as:
os.system(r"d:\tnd\bin\cawto.exe -cat NetNet %s" %
Jorge Ramirez schrieb:
>
> Hello,
>
> I would like to know how to open a pdf document using a python script.
- What do you mean by "open"?
- start a PDF viewer (e.g acrobar reader) from python?
- or read in the file in Python and extract information from it?
- What platform are you on?
-
Matt Williams schrieb:
> These seem to be at the opposite end of the spectrum - so do others have
> either comments on these options, or other suggestions.
Well, I havn't use either yet, but I have some experience with SQL DBs.
>From what I read on the website, Kirby seems like a nice idea, if you
Adam Cripps schrieb:
> Some of my pupils at school are working through simple mathematic
> problems (multiplication tables) through my website. I basically show
> some tables, they enter the results and then get feedback on how they
> did.
>
> I have two questions - and my guess is that one will b
Pierre Barbier de Reuille schrieb:
> Well, I have some comments ^_^
As should be always expected, when it comes to benchmarking ;-)
> First, about the function 6, it is exactly equivalent (and a little bit
> quicker) to use:
> [...]
> That is, put the try block outside the loop ... however, if th
Terry Kemmerer schrieb:
>
>
> "Bearing in mind that shorter is not necessarily better..."
>
> Wouldn't shorter, as a rule of thumb, as in less language statements, mean
> fewer
> executions, and therefore faster?
Well, see for yourself...
I wrote a little benchmarking script for different so
Pierre Barbier de Reuille schrieb:
> Well, in the specific case of numeric arrays, you can use Numeric or
> numarray :
>
> from Numeric import array, compress
>
> ol = array(original_list)
> selection = array([condition(i) for i in original_list)
> list1 = compress(selection, ol)
> list2 = compre
Alan G schrieb:
> My personal approach would be two separate comprehensions(*) which
> keeps the intent very clear and keeps it short at the expense
> of iterating the original list twice.
Of course this works only if condition(item) yields the same result each time
it is called with the same in
Danny Yoo schrieb:
>
> -- Forwarded message --
> Date: Wed, 14 Sep 2005 21:33:08 -0500
> From: JackA <[EMAIL PROTECTED]>
> To: Danny Yoo <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a
> machine that does not have Python installed
Hi,
I wonder if there is a shorter form of the following idiom:
list1 = []
list2 = []
for item in original_list:
if condition(item):
list1.append(item)
else:
list2.append(item)
(optional step:)
original_list[:] = list1
I call this the "Aschenputtel" problem, because it
Rob Andrews schrieb:
> I should already know this, and probably once did, but have never had
> a real world use for it until now.
>
> What's a nice, clean way to recursively scan through directories with
> an arbitrary number of subdirectories?
os.walk() is you friend! (Don't use os.path.walk() a
85 matches
Mail list logo