iPhone 备忘录的时间能够被修改吗 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Issuema
V2EX    问与答

iPhone 备忘录的时间能够被修改吗

  •  1
     
  •   Issuema 2022-06-19 01:21:59 +08:00 1518 次点击
    这是一个创建于 1261 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我把上部手机(小米)的便签导出成带时间戳的 txt 文件了,现在想通过脚本把文件分割,并修改各个文件的时间,以还原便签。分割文件倒是不难做,但是修改文件时间找一圈都没点头绪,有高手能提供点思路吗,,,

    第 1 条附言    2022-08-11 09:44:43 +08:00

    最后还是在windows环境下(没有mac)解决了,忘了上号补充,脚本如下,写得很辣鸡,见谅

    import re,linecache import pywintypes, win32file, win32con

    def changeFileCreationTime(fname, newtime): from datetime import datetime datetime_object = datetime.strptime(newtime, '%Y-%m-%d %H:%M:%S') winfile = win32file.CreateFile( fname, win32con.GENERIC_WRITE, win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE | win32con.FILE_SHARE_DELETE, None, win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL, None) # print(datetime_object) win32file.SetFileTime(winfile, datetime_object, None, None) winfile.close()

    inputfile = input('Input SourcFile:') ##输入源文件,如A.txt fp = open(inputfile, 'r',encoding="UTF-8") rex = r'\d{4}-\d?\d-\d?\d (?:2[0-3]|[01]?[0-9]):[0-5]?[0-9]:[0-5]?[0-9]' number =[] #用来存放指定分割字符所在行数 times=[] #用来存放所匹配的时间字符串 lineNumber = 1

    count = 0 #记录文件所有行数 for index, line in enumerate(fp): count += 1 m=re.search(rex,line) if m is not None: number.append(index) times.append(m)

    print(number)

    print(count)

    print(times[10].string)

    for i in range(0,len(number)-1): start = number[i] print(start) end = number[i+1] print(end) timestr=times[i].string.replace("\n","") print(timestr) destLines = linecache.getlines(inputfile)[start+1:end] #将行号为start+1到end-1的文件内容截取出来 fp_w = open('MiNote_' + str(i)+'.txt','w',encoding="utf-8") #将截取出的内容保存在输出文件中 for key in destLines: fp_w.write(key) fp_w.close() changeFileCreationTime(fp_w,timestr) #修改文件时间

    2 条回复    2022-06-19 14:41:50 +08:00
    Constantping
        1
    Constantping  
       2022-06-19 13:14:44 +08:00
    直接改手?
    Issuema
        2
    Issuema  
    OP
       2022-06-19 14:41:50 +08:00
    @Constantping 你的意思是每次修改系统时间来编辑文件吗?那这样的话我再把这个步骤加到脚本里好了
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     877 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 22ms UTC 19:15 PVG 03:15 LAX 11:15 JFK 14:15
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86