系统是 win10,在自学的《 Python 简明教程》,今天学到教程里的备份程序,程序跑通了,但是没有在 test 文件里找到备份的文件。cmd 也试过,还是没有 - V2EX
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
getlost

系统是 win10,在自学的《 Python 简明教程》,今天学到教程里的备份程序,程序跑通了,但是没有在 test 文件里找到备份的文件。cmd 也试过,还是没有

  •  
  •   getlost Jan 31, 2018 4133 views
    This topic created in 3025 days ago, the information mentioned may be changed or developed.
    import os
    import time

    source = [' d:\\Doc']

    target_dir = ' d:\\test '

    target = target_dir + os.sep + \
    time.strftime('%Y%m%d%H%M%S') + ' .zip'


    zip_command = 'zip -r {0} {1}'.format(target,
    ' '.join(source))

    print('zip command is:')
    print(zip_command)
    print('go')
    if os.system(zip_command) == 0:
    print('s', target)
    else:
    print('bb')
    Supplement 1    Feb 1, 2018
    zip command is:
    zip -r d:\test \20180201220751.zip "d:\Doc" d:\Doc1 (这里稍微有改动)
    go
    zip warning: name not matched: \20180201220751.zip
    updating: Doc/ (260 bytes security) (stored 0%)
    updating: Doc/python361.chm (172 bytes security) (deflated 0%)
    updating: Doc1/ (260 bytes security) (stored 0%)
    updating: Doc/22.txt (172 bytes security) (stored 0%)
    updating: Doc1/ Second Scan document.s2 (172 bytes security) (stored 0%)
    s d:\test \20180201220751.zip

    这是运行结果
    15 replies    2018-02-01 23:54:01 +08:00
    yichinzhu
        1
    yichinzhu  
       Jan 31, 2018
    windows 没有 zip 这个命令
    tennc
        2
    tennc  
       Jan 31, 2018
    你在 cmd 下 可以 用 zip 命令??
    安装个 7z 然后在用过 7z 命令吧~~
    HuaBeau
        3
    HuaBeau  
       Jan 31, 2018
    楼主仔细看下书,书上有如下内容:
    https://bop.mol.uno/13.problem_solving.html
    针对 Windows 用户的提示
    Windows 用户可以从 GnuWin32 项目页面( http://gnuwin32.sourceforge.net/packages/zip.htm ) 上下载并安装 zip 命令,并将 C:\Program Files\GnuWin32\bin 添加至你的系统的 PATH 环境变量中,这一操作过程与我们为使系统识别 Python 命令本身所做的事情相同。
    omph
        4
    omph  
       Jan 31, 2018
    装个 7zip,然后指定命令路径即可
    td width="auto" valign="top" align="left">
        5
    zyqf  
       Feb 1, 2018 via Android
    感觉 Windows 下写 Python 程序怪怪的。
    zyqf
    ntuwang
        6
    ntuwang  
       Feb 1, 2018
    楼主还是 换 mac 或者 Linux 桌面发行版 吧,学 python 来噻
    strive
        7
    strive  
       Feb 1, 2018
    装一个 winrar
    strive
        8
    strive  
       Feb 1, 2018
    @strive 用 start winner a 这个命令
    getlost
        9
    getlost  
    OP
       Feb 1, 2018
    @yichinzhu 谢谢你,我按照作者的提示装了 zip
    getlost
        10
    getlost  
    OP
       Feb 1, 2018
    @tennc 写好程序保存之后,在 cmd 里运行这个程序(我很白,以为在 pycharm 跑和 cmd 里不一样)
    getlost
        11
    getlost  
    OP
       Feb 1, 2018
    @HuaBeau 嗯,就是按照这个装了 zip 的,但是没在备份文件里找到压缩的文件
    getlost
        12
    getlost  
    OP
       Feb 1, 2018
    @omph 嗯,谢谢你,但是了解一点的就是 python 了,其他都不会。我去查查
    getlost
        13
    getlost  
    OP
       Feb 1, 2018
    @zyqf 之前装过乌班图,但是不会用,一直没法联网,又要忙着毕设就删了。毕业之后想学学 python
    getlost
        14
    getlost  
    OP
       Feb 1, 2018
    @strive 在 cmd 里用吗?
    omph
        15
    omph  
       Feb 1, 2018
    zip -r d:\test \20180201220751.zip
    你的路径里多了个空格吧?
    有空格应该用引号
    About     Help     Advertise     Blog     API     FAQ     Solana     3780 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 78ms UTC 04:57 PVG 12:57 LAX 21:57 JFK 00:57
    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