How to I do this in Python ?

Steven D'Aprano steve at pearwood.info
Mon Aug 19 03:27:50 EDT 2013


On Sun, 18 Aug 2013 22:36:01 +0530, Ganesh Pal wrote:

> Please find the comments >>> inline

Please don't do that!

"Arrows" > are used for quoting in emails. If you prefix your *new* 
comments using >>> it looks like they were quoted *three messages back*.

You should be able to configure your email or news client to prefix 
quoted text with a >, and then you just type your own comments with no 
prefix, like I'm doing here. Even Gmail can do that.

You seem to have copied-and-pasted my response into a new email, and then 
added your comments. Am I right? The normal way to reply to an email is 
to use Reply or Reply All.


[...]
>>>>   Thanks for the suggestion on creating empty files and  they worked
> fine . I was today playing with the temp-file  module to create 
> temporary files and directories ,
>          Iam yet to explore it completely, but in current context , I
>          had a
> quick question using temp-file module is its  possible to create empty
>  temporary files and save them on disk in the user-defined path ?

You shouldn't normally care about where temporary files are stored, since 
they're temporary and will disappear as soon as you are done with them. 
But yes, tempfile has the ability to control where the files are stored. 
Both tempfile.NamedTemporaryFile and tempfile.TemporaryFile take an 
optional directory argument.

To read the documentation, run these two commands at the interactive 
prompt:


import tempfile
help(tempfile)


or read it on the web:

http://docs.python.org/2/library/tempfile.html
http://docs.python.org/3/library/tempfile.html



>          If  " yes "  then can this also be an alternative and does this
> have any drawback  ?

Alternative to what? If you mean, alternative to *not* storing it in the 
user's directory, then yes, it is :-)

Drawbacks -- yes. I hate it when applications dump temporary files in my 
home directory.



-- 
Steven



More information about the Python-list mailing list