V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  syaokun219  ›  全部回复第 3 页 / 共 3 页
回复总数  47
1  2  3  
@iannil 哈哈,真心渣啊,找不到工作的节奏
@kmvan 也不是强调,就是说明自己的身份,应届生
@stackpop ~fullstack,大神高估我了。。主要是觉得前端的东西在实验室做的也太简单~不纠结了,努力学习就是王道~
2014-08-11 18:03:39 +08:00
回复了 zooooom 创建的主题 问与答 [求助]想给父母买部智能机,v 友们有什么推荐吗?
其实我觉得红米真的不错,尽管我原来是小米黑,但是给老妈在我们论坛上加价买了一个红米之后,她非常喜欢,也好用!现在准备给老爸买个note试试
@hahastudio 我知道了,好像是这个fnmatch的问题哈
@oseau 匹配不到呀,我上面贴了一下代码
@hahastudio 大神看我代码,为啥匹配不到呢
# -*- coding: utf-8 -*-
#########################################################################
# Author: Yao Kun
# Created Time: 五 8/ 8 07:42:26 2014
# File Name: testmac.py
# Description:
#########################################################################
import os
# 用于获得操作系统信息
import platform
import fnmatch

print "尝试删除扩展名为空,或者是不需要同步的文件"

sys = platform.system()
if sys == "Darwin":
sys = "Mac OS X"
print "Your system is", sys, ", this is a delete-file script..."
else:
print "您的操作系统是", sys, ",这是删除文件脚本"

def iterfindfiles(path, fnexp):
for root, dirs, files in os.walk(path):
# 遍历某个目录
for filename in fnmatch.filter(files, fnexp):
yield os.path.join(root, filename)

if sys == "Mac OS X":
search_path = r"/Users/mac-prisonbreak/百度云同步盘/"
else:
search_path = r"D:/百度云/Project"

print "Your current search dir is", search_path

flag = False
command = "check"

logfile = open("delete_log.txt", "w+")
for filename in iterfindfiles(search_path, "^([^\\]*)\.(\w+)$"):
print filename
logfile.write("\n"+filename)
# 删除是危险操作,需要确认
if command == "all" or command == "yes":
os.remove(filename)

if command == "yes":
command = "check"
elif command == "none":
pass
print "Do nothing"
else:
command = raw_input()
#关闭文件
logfile.close()
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   865 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 21:05 · PVG 05:05 · LAX 14:05 · JFK 17:05
Developed with CodeLauncher
♥ Do have faith in what you're doing.