os.system and quoted strings

Sick Monkey sickcodemonkey at gmail.com
Tue Feb 27 09:45:35 EST 2007


Do you mean:

>>> import time, os
>>> dir = "C:\\Documents and Settings\\somepath\\"
>>> fileName = time.strftime("%d%m%Y")
>>> finalname = "%s%s.txt" % (dir,fileName)
>>> print finalname
C:\Documents and Settings\somepath\27022007.txt


On 27 Feb 2007 06:24:41 -0800, svata <svatoboj at gmail.com> wrote:
>
> Hello,
>
> as I'm new to python I've stumbled accros os.system and its not very
> well documented usage.
>
> I use Win XP Pro and Python 2.5.
>
> Here is the code snippet:
>
>
> --------------------------------------------------------------------------------------------------
>
> import time
> import os
>
> dir = "C:\\Documents and Settings\\somepath\\"
> fileName = time.strftime("%d%m%Y")
> os.system('gvim dir+fileName+".txt"')
>
>
> ---------------------------------------------------------------------------------------------------
>
> The problem is that concatenated variable dir+fileName doesn't get
> expanded as expected.
>
> Is there anything I omitted?
>
> svata
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070227/14678d53/attachment.html>


More information about the Python-list mailing list