Re: Extract sigle file from zip file based on file extension

2017-02-10 Thread Amit Yaron
On 10/02/17 10:35, loial wrote: I need to be able to extract a single file from a .zip file in python. The zip file will contain many files. The file to extract will be the only .csv file in the zip, but the full name of the csv file will not be known. Can this be done in python? Yes, you can

Re: Extract sigle file from zip file based on file extension

2017-02-10 Thread Peter Otten
loial wrote: > I need to be able to extract a single file from a .zip file in python. > The zip file will contain many files. The file to extract will be the only > .csv file in the zip, but the full name of the csv file will not be known. > > Can this be done in python? See

Re: Extract sigle file from zip file based on file extension

2017-02-10 Thread Jussi Piitulainen
loial writes: > I need to be able to extract a single file from a .zip file in python. > > The zip file will contain many files. The file to extract will be the > only .csv file in the zip, but the full name of the csv file will not > be known. > > Can this be done in python? Find the one member

Extract sigle file from zip file based on file extension

2017-02-10 Thread loial
I need to be able to extract a single file from a .zip file in python. The zip file will contain many files. The file to extract will be the only .csv file in the zip, but the full name of the csv file will not be known. Can this be done in python? -- https://mail.python.org/mailman/listinfo/pyt

Re: file extension while saving Python files

2011-11-09 Thread 88888 Dihedral
In testing and debug it is better that a program can be easily modified and easy to set break point and dump values. Thus an interpreter environment is more convenient. But in the final version a compiler can speed up a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: file extension while saving Python files

2011-11-08 Thread Ned Deily
In article , vaira muthu wrote: > In Python IDE, while we save the script, it will prompt the save > Dialog. If we specify the filename as "Test". Then file will be saved > without extension as "Test" and not "Test.py". > > Is it possible to save the script with .py extension automatically (as

Re: file extension while saving Python files

2011-11-08 Thread mannan
if it is not a python ide then, you have to explicitly specify the extension. -- http://mail.python.org/mailman/listinfo/python-list

Re: file extension while saving Python files

2011-11-08 Thread John Gordon
In vaira muthu writes: > Team, > In Python IDE, while we save the script, it will prompt the save > Dialog. If we specify the filename as "Test". Then file will be saved > without extension as "Test" and not "Test.py". Is there a drop-down list selection for specifying the file type? -- Joh

Re: file extension while saving Python files

2011-11-08 Thread Magnus Lyckå
On 2011-11-08 11:05, vaira muthu wrote: In Python IDE, ... Which Python IDE? There are dozens: http://wiki.python.org/moin/IntegratedDevelopmentEnvironments -- http://mail.python.org/mailman/listinfo/python-list

file extension while saving Python files

2011-11-08 Thread vaira muthu
Team, In Python IDE, while we save the script, it will prompt the save Dialog. If we specify the filename as "Test". Then file will be saved without extension as "Test" and not "Test.py". Is it possible to save the script with .py extension automatically (as Test.py)? Thanks, vairamuthu. -- htt

Re: Reading text file with wierd file extension?

2009-02-03 Thread Steve Holden
John Machin wrote: > On Feb 3, 8:07 am, "Diez B. Roggisch" wrote: > >> This is written very slowly, so you can read it better: >> >> Please post the traceback. > > *AND* please post the text of the IOError message > > *AND* please do yourself a favour and move your files out of the root > direc

Re: Reading text file with wierd file extension?

2009-02-03 Thread Lionel
On Feb 2, 2:07 pm, John Machin wrote: > On Feb 3, 8:43 am, Lionel wrote: > > >         ResourceFilepath = DataFilepath + ".src" > > Don't you mean ".rsc"? Good Grief!!! That's It!! I've been staring at it all day and I didn't see it. I'm sorry I've wasted everyone's time. This is bloody embaras

Re: Reading text file with wierd file extension?

2009-02-03 Thread John Machin
On Feb 3, 8:43 am, Lionel wrote: >         ResourceFilepath = DataFilepath + ".src" Don't you mean ".rsc"? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading text file with wierd file extension?

2009-02-03 Thread John Machin
On Feb 3, 8:07 am, "Diez B. Roggisch" wrote: > > This is written very slowly, so you can read it better: > > Please post the traceback. *AND* please post the text of the IOError message *AND* please do yourself a favour and move your files out of the root directory into a directory with a meani

Re: Reading text file with wierd file extension?

2009-02-02 Thread john
On Feb 2, 7:57 pm, Mike Driscoll wrote: > On Feb 2, 8:08 pm, Lionel wrote: > > > > > On Feb 2, 5:40 pm, "Rhodri James" wrote: > > > > [Quoting restored for reduced > > > > On Mon, 02 Feb 2009 22:33:50 -, Lionel wrote: > > > > On Feb 2, 2:01 pm, Mike Driscoll wrote: > > > >> On Feb 2, 3:43 

Re: Reading text file with wierd file extension?

2009-02-02 Thread Mike Driscoll
On Feb 2, 8:08 pm, Lionel wrote: > On Feb 2, 5:40 pm, "Rhodri James" wrote: > > > > > [Quoting restored for reduced > > > On Mon, 02 Feb 2009 22:33:50 -, Lionel wrote: > > > On Feb 2, 2:01 pm, Mike Driscoll wrote: > > >> On Feb 2, 3:43 pm, Lionel wrote: > > >> > On Feb 2, 1:07 pm, "Diez B.

Re: Reading text file with wierd file extension?

2009-02-02 Thread Grant Edwards
On 2009-02-03, Rhodri James wrote: > [Quoting restored for reduced > > On Mon, 02 Feb 2009 22:33:50 -, Lionel wrote: > >> On Feb 2, 2:01 pm, Mike Driscoll wrote: >>> On Feb 2, 3:43 pm, Lionel wrote: >>> > On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: >>> >>> >> This is written very slowly,

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 5:40 pm, "Rhodri James" wrote: > [Quoting restored for reduced > > On Mon, 02 Feb 2009 22:33:50 -, Lionel wrote: > > On Feb 2, 2:01 pm, Mike Driscoll wrote: > >> On Feb 2, 3:43 pm, Lionel wrote: > >> > On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: > > >> >> This is written very sl

Re: Reading text file with wierd file extension?

2009-02-02 Thread Rhodri James
[Quoting restored for reduced On Mon, 02 Feb 2009 22:33:50 -, Lionel wrote: On Feb 2, 2:01 pm, Mike Driscoll wrote: On Feb 2, 3:43 pm, Lionel wrote: > On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: >> This is written very slowly, so you can read it better: > Please post without sarcasm

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 4:50 pm, Denis Kasak wrote: > On Mon, Feb 2, 2009 at 10:43 PM, Lionel wrote: > > > > > >>> ResourcefilePath > > 'C:\\C8Example1.slc.rsc' > > > > > C:\C8Example1.slc.src > > The extension you used in the interactive shell differs from the one > you used in the class code (i.e. "rsc" vs

Re: Reading text file with wierd file extension?

2009-02-02 Thread Denis Kasak
On Mon, Feb 2, 2009 at 10:43 PM, Lionel wrote: > >>> ResourcefilePath > 'C:\\C8Example1.slc.rsc' > C:\C8Example1.slc.src The extension you used in the interactive shell differs from the one you used in the class code (i.e. "rsc" vs "src"). -- Denis Kasak -- http://mail.python.org/mailman/

Re: Reading text file with wierd file extension?

2009-02-02 Thread MRAB
Lionel wrote: On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: This is written very slowly, so you can read it better: Please post without sarcasm. This is the output from my Python shell: DatafilePath = "C:\\C8Example1.slc" ResourcefilePath = DatafilePath + ".rsc" DatafileFH = open(DatafilePa

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 2:01 pm, Mike Driscoll wrote: > On Feb 2, 3:43 pm, Lionel wrote: > > > > > > > On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: > > > This is written very slowly, so you can read it better: > > > Please post without sarcasm. > > > This is the output from my Python shell: > > > >>> Datafile

Re: Reading text file with wierd file extension?

2009-02-02 Thread Mike Driscoll
On Feb 2, 3:43 pm, Lionel wrote: > On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: > > This is written very slowly, so you can read it better: > > Please post without sarcasm. > > This is the output from my Python shell: > > >>> DatafilePath = "C:\\C8Example1.slc" > >>> ResourcefilePath = DatafilePa

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 1:07 pm, "Diez B. Roggisch" wrote: This is written very slowly, so you can read it better: Please post without sarcasm. This is the output from my Python shell: >>> DatafilePath = "C:\\C8Example1.slc" >>> ResourcefilePath = DatafilePath + ".rsc" >>> DatafileFH = open(DatafilePath) >

Re: Reading text file with wierd file extension?

2009-02-02 Thread Stephen Hansen
> class MyUtilityClass: >def __init__(self, DataFilepath): >Resourcepath = DataFilepath + ".rsc" >DataFileH = open(DataFilepath) >ResourceFileH = open(Resourcepath) There's nothing wrong with this code. You have to look elsewhere in your program-- perhaps what cal

Re: Reading text file with wierd file extension?

2009-02-02 Thread Diez B. Roggisch
Lionel schrieb: On Feb 2, 12:10 pm, Mike Driscoll wrote: On Feb 2, 1:20 pm, Lionel wrote: On Feb 2, 10:41 am, Mike Driscoll wrote: On Feb 2, 12:36 pm, Lionel wrote: Hi Folks, Python newbie here. I'm trying to open (for reading) a text file with the following filenaming convension: "M

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 12:10 pm, Mike Driscoll wrote: > On Feb 2, 1:20 pm, Lionel wrote: > > > > > > > On Feb 2, 10:41 am, Mike Driscoll wrote: > > > > On Feb 2, 12:36 pm, Lionel wrote: > > > > > Hi Folks, Python newbie here. > > > > > I'm trying to open (for reading) a text file with the following > > > >

Re: Reading text file with wierd file extension?

2009-02-02 Thread Mike Driscoll
On Feb 2, 1:20 pm, Lionel wrote: > On Feb 2, 10:41 am, Mike Driscoll wrote: > > > > > On Feb 2, 12:36 pm, Lionel wrote: > > > > Hi Folks, Python newbie here. > > > > I'm trying to open (for reading) a text file with the following > > > filenaming convension: > > > > "MyTextFile.slc.rsc" > > > >

Re: Reading text file with wierd file extension?

2009-02-02 Thread Diez B. Roggisch
Hi Mike, maybe it's not a "true" text file? Opening it in Microsoft Notepad gives an unformatted view of the file (text with no line wrapping, just the end-of-line square box character followed by more text, end- of-line character, etc). Wordpad opens it properly i.e. respects the end-of-line wra

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 11:20 am, Lionel wrote: > On Feb 2, 10:41 am, Mike Driscoll wrote: > > > > > > > On Feb 2, 12:36 pm, Lionel wrote: > > > > Hi Folks, Python newbie here. > > > > I'm trying to open (for reading) a text file with the following > > > filenaming convension: > > > > "MyTextFile.slc.rsc" > >

Re: Reading text file with wierd file extension?

2009-02-02 Thread Lionel
On Feb 2, 10:41 am, Mike Driscoll wrote: > On Feb 2, 12:36 pm, Lionel wrote: > > > > > > > Hi Folks, Python newbie here. > > > I'm trying to open (for reading) a text file with the following > > filenaming convension: > > > "MyTextFile.slc.rsc" > > > My code is as follows: > > > Filepath = "C:\\M

Re: Reading text file with wierd file extension?

2009-02-02 Thread Stephen Hansen
> > The above works well. I am able to open the file and read it's > contents. I assume to read a file in text file "mode" the parameter is > scanned for a ".txt" extension, otherwise the Python runtime doesn't > know what version of "open(...)" to invoke. How do I pass the original > filename (MyT

Re: Reading text file with wierd file extension?

2009-02-02 Thread Simon Brunning
2009/2/2 Lionel : > Hi Folks, Python newbie here. > > I'm trying to open (for reading) a text file with the following > filenaming convension: > > "MyTextFile.slc.rsc" Some kind of a resource fork, perhaps? Where did the file come from? Python doesn't do anything magic with filenames, so this mus

Re: Reading text file with wierd file extension?

2009-02-02 Thread Mike Driscoll
On Feb 2, 12:36 pm, Lionel wrote: > Hi Folks, Python newbie here. > > I'm trying to open (for reading) a text file with the following > filenaming convension: > > "MyTextFile.slc.rsc" > > My code is as follows: > > Filepath = "C:\\MyTextFile.slc.rsc" > FileH = open(Filepath) > > The above throws a

Reading text file with wierd file extension?

2009-02-02 Thread Lionel
Hi Folks, Python newbie here. I'm trying to open (for reading) a text file with the following filenaming convension: "MyTextFile.slc.rsc" My code is as follows: Filepath = "C:\\MyTextFile.slc.rsc" FileH = open(Filepath) The above throws an IOError exception. On a hunch I changed the filename (

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-06 Thread Steve Holden
Fredrik Lundh wrote: > Steve Holden wrote: > >>> for reference, here's what I get on Ubuntu 7.10, with the standard >>> Python interpreter (2.5.1): >>> >>> $ python -c "import imp; print imp.get_suffixes()" >>> [('.so', 'rb', 3), ('module.so', 'rb', 3), ('.py', 'U', 1), >>> ('.pyc', 'rb', 2)] >>>

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-06 Thread Roel Schroeven
llothar schreef: >> There are ways to build distributions of Python extensions (modules or >> packages involving binary code from languages like C or C++), but you >> will want to understand a bit more about computing in general > > Believe me nobody needs to teach me anything about general progra

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-06 Thread Fredrik Lundh
Steve Holden wrote: >> for reference, here's what I get on Ubuntu 7.10, with the standard >> Python interpreter (2.5.1): >> >> $ python -c "import imp; print imp.get_suffixes()" >> [('.so', 'rb', 3), ('module.so', 'rb', 3), ('.py', 'U', 1), >> ('.pyc', 'rb', 2)] >> >> any Ubuntu gurus here that c

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Steve Holden
Fredrik Lundh wrote: > Fredrik Lundh wrote: > >> and for the record, Python doesn't look for PYD files on any of the Unix >> boxes I have convenient access to right now. what Ubuntu version are >> you using, what Python version do you have, and what does >> >> $ python -c "import imp; prin

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Martin v. Löwis
> There must be a rule behind this. There are multiple rules behind this. Python normally uses the same extension for shared libraries as the operating system, as the operating system may refuse to load them if it doesn't. So it *can't* use .pyd on Unix, because that might not work (on some implem

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Fredrik Lundh
Fredrik Lundh wrote: > and for the record, Python doesn't look for PYD files on any of the Unix > boxes I have convenient access to right now. what Ubuntu version are > you using, what Python version do you have, and what does > > $ python -c "import imp; print imp.get_suffixes()" > > pr

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Steve Holden
llothar wrote: [...] > Unfortunately there is no python.core mailing list that i know so i > ask here. > Well your researches can't have been that extensive: the developers live on [EMAIL PROTECTED], otherwise known as comp.land.python-dev. But you will need to ask your question rather more care

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Fredrik Lundh
llothar wrote: > I don't think so. I asked a pretty simple question and as usual on > usenet nobody read the question did *you* read your own question? it took you three posts before you mentioned what you were trying to do, and four posts before you bothered to mention that you're seeing this

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread llothar
> Right, so you think people aren't trying to help you? I think they are not reading the question. > You display your ignorance here. The ".pyd" extension is used on Windows > as an alternative to ".dll", but both are recognized as shared > libraries. Personally I'm not really sure why they even

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Fredrik Lundh
Steve Holden wrote: > You display your ignorance here. The ".pyd" extension is used on Windows > as an alternative to ".dll", but both are recognized as shared > libraries. Personally I'm not really sure why they even chose to use > ".pyd", which is confusing to most Windows users. In UNIX/Linu

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Steve Holden
llothar wrote: > On 5 Apr., 15:48, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> llothar wrote: >>> My question was: Why does setup.py generated sometimes a pyd and >>> sometimes a so file? >> setup.py picks an extension that happens to work on the platform you're >> running setup.py on. doing other

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Fredrik Lundh
llothar wrote: > I ship an application that compiles an python interpreter and > extension on a remote system. > It also needs to copy this created items around. So if i use setup.py > to create an > extension i need to know the file name of the generated file. so why not just ask setup.py

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread llothar
On 5 Apr., 15:48, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > llothar wrote: > > My question was: Why does setup.py generated sometimes a pyd and > > sometimes a so file? > > setup.py picks an extension that happens to work on the platform you're > running setup.py on. doing otherwise would be pret

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-05 Thread Fredrik Lundh
llothar wrote: > My question was: Why does setup.py generated sometimes a pyd and > sometimes a so file? setup.py picks an extension that happens to work on the platform you're running setup.py on. doing otherwise would be pretty pointless. -- http://mail.python.org/mailman/listinfo/python-

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-04 Thread llothar
Thanks, my question was not how can i make python to it find. I don't have a problem. My question was: Why does setup.py generated sometimes a pyd and sometimes a so file? There must be a rule behind this. Unforunately setup.py is not well documented. Here i mean i need a specification not a tut

Re: When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-04 Thread Fredrik Lundh
llothar wrote: > On windows everything is '.pyd' but there seems to be two ways to get > this on unix? If you attempt to import the module "spam" on Windows, Python looks for "spam.dll" and "spam.pyd" (in addition to "spam.py/spam.pyw/spam.pyc" etc) On most Unix platforms, Python looks for "spa

When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-03 Thread llothar
On windows everything is '.pyd' but there seems to be two ways to get this on unix? Why and what is the rule? -- http://mail.python.org/mailman/listinfo/python-list

Re: File extension

2007-03-17 Thread Steve Holden
Anil Kumar wrote: > Hi, > > Can Python Script can have different extensions like .sh etc Or Is > .py is mandatory to be present as the extension for the Python Script. > The interpreter itself doesn't really care. The issues you are hotting are due to operating system. and command shell d

Re: File extension

2007-03-17 Thread Gabriel Genellina
it's ok; but if you run it just using: scriptname.sh, won't work; Windows uses the file extension to determine the program to run, instead of the !# line. > The reason I am trying to change the extension is, it reduces lot of > porting > changes. No need to go to each of

File extension

2007-03-16 Thread Anil Kumar
Hi, Can Python Script can have different extensions like .sh etc Or Is .py is mandatory to be present as the extension for the Python Script. We have an application where the script was initially written in shell script with extension .sh. Now we are migrating this script to be run in both U

Re: Can I import a file without file extension .py?

2007-02-01 Thread Dustan
On Feb 1, 12:51 am, "Jia Lu" <[EMAIL PROTECTED]> wrote: > > def make_module_from_file(module_name, file_name): > > """ Make a new module object from the code in specified file """ > > > from types import ModuleType > > module = ModuleType(module_name) > > > modul

Re: Can I import a file without file extension .py?

2007-01-31 Thread Jia Lu
> > def make_module_from_file(module_name, file_name): > """ Make a new module object from the code in specified file """ > > from types import ModuleType > module = ModuleType(module_name) > > module_file = open(file_name, 'r') > exec module_file in modu

Re: Can I import a file without file extension .py?

2007-01-31 Thread Ben Finney
"Jia Lu" <[EMAIL PROTECTED]> writes: > I wonder if I can import a file with other file extensions ? I use this function in most of my test infrastructures, to import programs as modules for unit testing. def make_module_from_file(module_name, file_name): """ Make a new module object

Can I import a file without file extension .py?

2007-01-31 Thread Jia Lu
Hi all I wonder if I can import a file with other file extensions ? Can I do that only with python? Thank you Jia Lu -- http://mail.python.org/mailman/listinfo/python-list

Re: pyj file extension

2006-11-16 Thread Paul Boddie
Diez B. Roggisch wrote: > > http://www.crazy-compilers.com/decompyle/ > > But only up to python 2.3. No idea if that is sufficient & if there is > anything newer out there. Usual service message: sources available from here... http://packages.debian.org/unstable/source/decompyle Paul -- http:/

Re: pyj file extension

2006-11-16 Thread Diez B. Roggisch
bituman wrote: > I have two questions for the list: > - what extension is pyj ? AFAIK custom to some game that uses python - but I guess you already know that. > - is there a good python debugger that can inspect precompiled python > files? You can decompyle them: http://www.crazy-compiler

pyj file extension

2006-11-16 Thread bituman
I have two questions for the list: - what extension is pyj ? - is there a good python debugger that can inspect precompiled python files? Thank you :) -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils and binding a script to a file extension on windows

2006-05-14 Thread Miki
Hello Alex, Not really an answer but if you use InnoSetup (http://www.jrsoftware.org/) you can set file type association (see http://www.jrsoftware.org/isfaq.php) HTH, Miki -- http://mail.python.org/mailman/listinfo/python-list

distutils and binding a script to a file extension on windows

2006-05-13 Thread Alexandre Guimond
Hi. I built a little installer on windows XP using distutils for my package. In there i add a few files to the python script directory. I would like one of these scripts to be the default program to be used by files with a given extention (e.g. i have an image viewer and would like it to be used w

Re: win32 - associate .pyw with a file extension...

2005-08-22 Thread Alessandro Bottoni
[EMAIL PROTECTED] wrote: > Hello! > > I'm trying to associate a file extension to my wxPython script so that > all I have to do is double click on the file and my python script will > load up with the path of that file. > > For instance, I've associated all

win32 - associate .pyw with a file extension...

2005-08-21 Thread knutsample
Hello! I'm trying to associate a file extension to my wxPython script so that all I have to do is double click on the file and my python script will load up with the path of that file. For instance, I've associated all .py files to be opened up with emacs.exe. If I double click on

Re: Help sorting a list by file extension

2005-08-12 Thread Peter A.Schott
OK - I actually got something working last night with a list that is then converted into a dictionary (dealing with small sets of data - < 200 files per run). However, I like the sorted list option - I didn't realize that was even an option within the definition and wasn't quite sure how to get th

Re: Help sorting a list by file extension

2005-08-12 Thread Cyril Bazin
Maybe simpler but not very much simpler: one line for each solution. And in your solution the lambda is evaluated at each comparaison of the sort algorithm isn't it? So your code seems less productive than the bengt's code which apply the same code as the lambda only one time by entry in the li

Re: Help sorting a list by file extension

2005-08-12 Thread Tom Anderson
On Fri, 12 Aug 2005, Bengt Richter wrote: > On Fri, 12 Aug 2005 00:06:17 GMT, Peter A. Schott <[EMAIL PROTECTED]> wrote: > >> Trying to operate on a list of files similar to this: >> >> test.1 >> test.2 >> test.3 >> >> I want to sort them in numeric order instead of string order. > > >>> [name for

Re: Help sorting a list by file extension

2005-08-11 Thread George Yoshida
Bengt Richter wrote: [name for dec,name in sorted((int(nm.split('.')[1]),nm) for nm in namelist)] > > ['test.1', 'test.2', 'test.3', 'test.4', 'test.10', 'test.15', 'test.20'] Giving a key argument to sorted will make it simpler:: >>> sorted(namelist, key=lambda x:int(x.rsplit('.')[-1])) --

Re: Help sorting a list by file extension

2005-08-11 Thread Bengt Richter
On Fri, 12 Aug 2005 00:06:17 GMT, Peter A. Schott <[EMAIL PROTECTED]> wrote: >Trying to operate on a list of files similar to this: > >test.1 >test.2 >test.3 >test.4 >test.10 >test.15 >test.20 > >etc. > >I want to sort them in numeric order instead of string order. I'm starting >with >this code:

Help sorting a list by file extension

2005-08-11 Thread Peter A.Schott
Trying to operate on a list of files similar to this: test.1 test.2 test.3 test.4 test.10 test.15 test.20 etc. I want to sort them in numeric order instead of string order. I'm starting with this code: import os for filename in [filename for filename in os.listdir(os.getcwd())]: print

Re: Registering File Extension?!?

2005-04-08 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > probably this question has been asked before, but I am unable to find > an answer... I have a big application (written in Python + a GUI in wxPython) > which allows the user to save its work in a file with an extension .glb. > Does anyone know if is there a way (on Wi

Registering File Extension?!?

2005-04-08 Thread andrea_gavana
Hello NG, probably this question has been asked before, but I am unable to find an answer... I have a big application (written in Python + a GUI in wxPython) which allows the user to save its work in a file with an extension .glb. Does anyone know if is there a way (on Windows, but also on oth

Re: starting windows program from python based on file extension ?

2005-03-03 Thread F. Petitjean
Le 3 Mar 2005 02:53:51 -0800, [EMAIL PROTECTED] a écrit : > Hi everybody, > > I used python to build a HTML file and now I would like to > automatically start my browser to display this file. I guess I could > use os.system(), but then I had to specify a specific path to the > browser. > > I wond

Re: starting windows program from python based on file extension ?

2005-03-03 Thread Duncan Booth
wrote: > I wonder if it is possible to tell windows to open "myFile.html" using > the program that is registered to open html files (similar to double > clicking on the file). > > Any idea how to do that from python ?? >>> import webbrowser >>> webbrowser.open('test.html') -- http://mail.pyth

RE: starting windows program from python based on file extension ?

2005-03-03 Thread Tim Golden
[EMAIL PROTECTED] | I used python to build a HTML file and now I would like to | automatically start my browser to display this file. I guess I could | use os.system(), but then I had to specify a specific path to the | browser. | | I wonder if it is possible to tell windows to open "myFile.html"

starting windows program from python based on file extension ?

2005-03-03 Thread kowald
Hi everybody, I used python to build a HTML file and now I would like to automatically start my browser to display this file. I guess I could use os.system(), but then I had to specify a specific path to the browser. I wonder if it is possible to tell windows to open "myFile.html" using the progr