用python怎么写下面的代码

(1)在Eclipse pyDev编程环境中,编写并运行程序。获取当前系统时间,并将其写入到time.txt文件中。
(2) 在Eclipse pyDev编程环境中,编写并运行程序。从键盘输入n个整数存入文件file.dat,然后从文件读出存入列表,将这n个数的最大值和其所在的序号在屏幕上显示出来。
例如:n个整数为:{123, 321, 456, 654, 789, 987, 963, 852}

#! /usr/bin/env python
# codeing:utf-8

import datetime

def get_time()

    now = datetime.datetime.now()

    with open('time.txt', 'w') as f:

        f.write(str(d))                            #简单点可以这么些,如果要格式化时间参见strftime
第二个懒得写了,提示用json或cPickle作为数据格式

温馨提示:答案为网友推荐,仅供参考
相似回答