[Tutor] Process list elements as consecutive pairs
Hi I am trying to Process list elements as consecutive pairs into consecutive pairs. Any pythonic suggestions? listin = [1,2,3,4,5,6,7,8,9,10] I want to process as consecutive pairs 1,2 3,4 5,6 7,8 9,10 Thanks Rudiger ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Porting PHP web app to Python GUI
On Mon, 12 Oct 2009 14:17 +0200, "Dotan Cohen" wrote: > I prefer the second route, but I want to know if this seems reasonable > in Python: > 1) GUI with several input areas which are analogous to the HTML > Select, Input=Text, and Textarea fields. > 2) insert the data collected into an sqlite database > 3) Retrieve and display data from the database using predefined queries. > > I am familiar with the SQL language, some PHP and some C programing. I > have never done GUI programming other than HTML. Does PyQt seem to > have a reasonable learning curve for this application? > EasyGUI makes it simple to add GUI to python app. http://easygui.sourceforge.net/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Finding and Inserting missing dates in a date range.
Ah! but are we sure that the max and min dates are actually in the list? If there are 'missing dates' it might just be possible that it is the max or min date that is missing. On Fri, 09 Oct 2009 16:43 -0400, "Kent Johnson" wrote: > On Fri, Oct 9, 2009 at 3:16 PM, Glen Zangirolami > wrote: > > If i have a list of dates: > > date_list = > > ['2008-12-29','2008-12-31','2008-01-01','2008-01-02','2008-01-03','2008-01-05'] > > How do I find the missing dates in the range of dates and insert them into > > the list so I get? > > date_list = > > ['2008-12-29','2008-12-30','2008-12-31','2008-01-01','2008-01-02','2008-01-03','2008-12-04','2008-01-05'] > > I would do something like the following using datetime.datetime and > datetime.timedelta: > - convert each list item to a datetime object using datetime.strptime() > - find the min and max datetimes in the list (use min() and max() > - create a new list by incrementing the min date by timedelta(days=1) > until it hits the max date > - convert the new list to strings using datetime.strftime() > > Kent ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Using command line tool with python script
On Mon, 05 Oct 2009 12:59 -0400, "Kent Johnson" wrote: > On Mon, Oct 5, 2009 at 10:22 AM, Oleg Oltar > wrote: > > > os.popen4("application -parameter1 -file temp.txt") > > > > I wonder if that possible to execute this script (called application) > > without writing the file with initial data to the hard disk? > > If "application" can take its input from stdin then you can use the > subprocess module to launch it and pipe data to it. If "application" > requires a file for input then I think you have to write a file. Matt Harrison have some notes and a video of a talk about good python scripting practices. He describes some patterns that enable you to write python scripts that can be chained together as they process data from one and send it to the next. See the following links for more info. http://panela.blog-city.com/oscon_scripting_with_python_handout.htm http://en.oreilly.com/oscon2009/public/schedule/detail/8317 He created a tool called poachplate so that it is easier to create these kind of scripts. http://pypi.python.org/pypi?%3Aaction=search&term=poachplate Regards Rudiger ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] using easy_install to download eggs
Snip from PIP http://pypi.python.org/pypi/pip/0.4 Differences From easy_install pip cannot install some packages. Specifically: * It cannot install from eggs. It only installs from source. (Maybe this will be changed sometime, but it's low priority.) If you want to download eggs then you might try basketweaver? http://pypi.python.org/pypi/basketweaver/ basketweaver is a tool for creating your own package index out of a directory full of eggs. You can then point to this index with e.g. zc.buildout or setuptools and thus be independant of PyPI. Cheers Rudiger On Mon, 05 Oct 2009 12:28 +, "Tim Michelsen" wrote: > Hi, > thanks for the hint. > > > pip (http://pypi.python.org/pypi/pip/) is a drop-in replacement for the > > easy_install tool and can do that. > > > > Just run easy_install pip and set an environment variable > > PIP_DOWNLOAD_CACHE to the path you want pip to store the files. Note > > that the cache won't work with dependencies that checkout from a source > > code repository (like svn/git/hg/bzr). > > I tried this. > > It saves the downloaded packages in a form of: > http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FB%2FBareNecessities% > 2FBareNecessities-0.2.2.tar.gz.content-type > http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FB%2FBareNecessities% > 2FBareNecessities-0.2.2.tar.gz > > I was looking for *.egs or *.exe pachages. > > Any ideas? > > Regards, > Timmie > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] using easy_install to download eggs
http://stackoverflow.com/questions/529425/easyinstall-cache-downloaded-files pip (http://pypi.python.org/pypi/pip/) is a drop-in replacement for the easy_install tool and can do that. Just run easy_install pip and set an environment variable PIP_DOWNLOAD_CACHE to the path you want pip to store the files. Note that the cache won't work with dependencies that checkout from a source code repository (like svn/git/hg/bzr). Then use pip install instead of easy_install On Sun, 04 Oct 2009 18:41 +, "Tim Michelsen" wrote: > Hello, > I would like to use easy_install to cache packages registered at PyPi > locally. > > How can I do this for packages? > > I tried the hints from: > http://peak.telecommunity.com/DevCenter/EasyInstall#installing-on-un-networked-machines > > It worked for some packages. > But for others, the command > > easy_install -zxad. mercurial > > just creates a subdirectory and not an *.egg file. > > How can I > 1) use easy_install to download packages from PyPi to a locally saved > egg-file? > 2) use easy_install to download archinves (*.tar.gz / *.zip) to download > the > respective software package from the link indicated on PyPi? > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to python: some advises for image processing tool
I remember reading some Python tutorials that where written specifically for Astronomers. Did a search on Google. This is not the tutorial I originally read but maybe you will find it to be useful. http://www.stsci.edu/hst/training/events/Python/readManDispImages_WU.pdf Regards Rudiger On Fri, 02 Oct 2009 11:47 +0200, "Nicola De Quattro" wrote: > Hi, > I'm a 26 years old Italian engineer. Because to the fact that I'm an > astrophile and astronomical tool (expecially under Linux) are not so > common, I would like to develop some simple tool for some purposes. > Well, I'm not knew to software development but I've never used python. > So I want to list you my needed for the first tool, so you can tell me > if Python could be a good choice and how to begin the develop. > First of all, I need a software running both under Windows and Linux > at least (it would be better if running either under MacOS). This is a > first reason to choose Python. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Examples using Poachplate
Hi Matt Harrison created what appears to be a really nifty tool called poachplate. A python script boilerplate. http://pypi.python.org/pypi?%3Aaction=search&term=poachplate See the following links for more info. http://panela.blog-city.com/oscon_scripting_with_python_handout.htm http://en.oreilly.com/oscon2009/public/schedule/detail/8317 I was wondering if anyone has used this and could direct me to a few simple scripts/examples that used this tool. I guess I'm looking for some tips on how I go start using poachplate to create some simple example scripts. Thanks Rudi ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor