load module named "datetime" and change the directory of output file?

Discussion in 'Python' started by ye juan, Feb 1, 2006.

  1. ye juan

    ye juan Guest

    Hi, all

    I have some questions to ask:

    1. How can I add a standard module named "datetime" in
    Jython when the error happens :"Traceback (innermost
    last):
    File "C:\python\test.py", line 3, in ?
    ImportError: no module named datetime "
    The line 3 is writen: "from datetime import datetime,
    tzinfor"

    2. I hope test.py outputs a file like test.txt, but I
    want to change the directory of the result file named
    test.txt. for example, the result is in
    c:\python\test.txt, but I want to put it in
    c:\python\result\test.txt. How can I change the
    directory in java?

    Thanks for your answer!

    Sincerely,

    Erica







    ___________________________________________________________
    ÎÞÏÞÈÝÁ¿ÑÅ»¢Ïà²á£¬Ô­Í¼µÈ´óÏÂÔØ£¬³¬¿ìËٶȣ¬¸Ï¿ìÇÀ×¢£¡
    http://cn.photos.yahoo.com
     
    ye juan, Feb 1, 2006
    #1
    1. Advertising

  2. ye juan

    Lee Harr Guest

    > 1. How can I add a standard module named "datetime" in
    > Jython when the error happens :"Traceback (innermost
    > last):
    > File "C:\python\test.py", line 3, in ?
    > ImportError: no module named datetime "
    > The line 3 is writen: "from datetime import datetime,
    > tzinfor"
    >


    The datetime module was added with Python 2.3. I think
    that Jython is still at the 2.1 or 2.2 level of Python.

    I believe that the Jython team is pretty far along the
    path to Python 2.4, but that is probably a question best
    asked on one of their lists.



    > 2. I hope test.py outputs a file like test.txt, but I
    > want to change the directory of the result file named
    > test.txt. for example, the result is in
    > c:\python\test.txt, but I want to put it in
    > c:\python\result\test.txt. How can I change the
    > directory in java?
    >



    Sort of depends on how you are writing the output.
    You could do something like ...

    fh = open(r"c:\python\result\test.txt", "w")
    fh.write("something")

    right?

    What does your code look like now? It is easier to
    help you fix it than to start fresh....
     
    Lee Harr, Feb 1, 2006
    #2
    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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    736
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    559
    Tim Peters
    Sep 9, 2003
  3. F. GEIGER
    Replies:
    0
    Views:
    934
    F. GEIGER
    Aug 16, 2004
  4. mp
    Replies:
    1
    Views:
    406
    John Machin
    Jul 28, 2006
  5. Martin
    Replies:
    0
    Views:
    355
    Martin
    Dec 27, 2008
Loading...

Share This Page