Re: creating python code with dynamic file name

Discussion in 'Python' started by Dave Angel, May 15, 2009.

  1. Dave Angel

    Dave Angel Guest

    bijoy franco wrote:
    > hi,
    >
    >
    > How can i create python code, for which filename can be defined on the
    > fly..?
    >
    > for example, in a blog, when each article selected, respective python code
    > with headline of the article as filename should be called.
    >
    > thanks
    >
    > bijoy
    >
    >

    You could have been much clearer in your requirements. I have to guess:

    Perhaps you're writing a CGI script to run on Linux, with Python 2.3.
    You need to be able to import a different python file, depending on some
    data calculation. You have three different such python files, whose
    names are known ahead of time.
    if data == "English":
    import english
    elif data == "Spanish":
    import spanish
    else:
    import nativeamerican

    Or is it:
    You're writing a script on Windows Server 2003, that's going to generate
    python 3.0 source code, and html, and the code and the html it generates
    is dependent on some data retrieved from Yahoo stock quotes. The python
    all has to be version 3.1


    Supply your environment, your requirements, some example data, and some
    test code that doesn't quite work. Then someone will probably be able
    to point out the problem.


    I could suggest you play with __import__() But of course that's not
    available everywhere.
     
    Dave Angel, May 15, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. corejavagroups
    Replies:
    6
    Views:
    3,599
    Roedy Green
    Nov 21, 2005
  2. =?iso-8859-1?B?bW9vcJk=?=
    Replies:
    7
    Views:
    894
    Roedy Green
    Jan 2, 2006
  3. ding feng
    Replies:
    2
    Views:
    2,912
    ding feng
    Jun 25, 2003
  4. Bobby Chamness
    Replies:
    2
    Views:
    2,443
    Joe Smith
    Apr 22, 2007
  5. Greg Hoover
    Replies:
    1
    Views:
    508
    Robert Bossy
    Mar 25, 2008
Loading...

Share This Page