On Wed, 21 May 2008 17:56:38 -0700, bukzor wrote:
On May 21, 5:37 pm, Nikhil [EMAIL PROTECTED] wrote:
if os.path.exists('file'):
open('file', 'w').close()
Right?
You only want to blank it if it exists? If it doesn't exist you won't
create it.
The .close() is superlative: since
After os.path.exists, you need to check it _is_ a
file, and not a directory.
Giampaolo Rodola' wrote:
On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote:
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are there any simpler methods?
Just use os.path.exists to check
On 22 Mag, 11:54, Ken Starks [EMAIL PROTECTED] wrote:
After os.path.exists, you need to check it _is_ a
file, and not a directory.
Giampaolo Rodola' wrote:
On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote:
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are
On May 22, 12:07 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Wed, 21 May 2008 17:56:38 -0700, bukzor wrote:
On May 21, 5:37 pm, Nikhil [EMAIL PROTECTED] wrote:
if os.path.exists('file'):
open('file', 'w').close()
Right?
You only want to blank it if it exists? If
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are there any simpler methods?
--
http://mail.python.org/mailman/listinfo/python-list
On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote:
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are there any simpler methods?
Just use os.path.exists to check for file existence and open() as
replacement for touch.
import os
if not os.path.exists('file'):
...
On May 21, 5:10 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote:
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are there any simpler methods?
Just use os.path.exists to check for file existence and open() as
bukzor wrote:
On May 21, 5:10 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote:
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are there any simpler methods?
Just use os.path.exists to check for file existence and
On May 21, 5:37 pm, Nikhil [EMAIL PROTECTED] wrote:
bukzor wrote:
On May 21, 5:10 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
On 22 Mag, 01:15, Nikhil [EMAIL PROTECTED] wrote:
what are the simple ways?
I could think of os.open(), os.exec(touch file)
are there any simpler methods?