当前位置: 首页 > news >正文

做外贸手机网站百度seo报价

做外贸手机网站,百度seo报价,政府网站建设标准,网站互动营销完成了文件自动分类的操作后,我们一起来复习下: 首先,获取文件夹中所有文件名称,用 os.path.join() 函数拼接出要移动到的目标地址。然后,使用 os.path.exists() 函数判断目标文件夹是否存在,不存在用 os.m…

完成了文件自动分类的操作后,我们一起来复习下:

首先,获取文件夹中所有文件名称,用 os.path.join() 函数拼接出要移动到的目标地址。然后,使用 os.path.exists() 函数判断目标文件夹是否存在,不存在用 os.mkdir() 创建文件夹。再者,使用 os.path.isdir() 函数判断是否为文件夹。最后,当不是文件夹时,使用 shutil.move() 函数移动。

# 使用import导入os模块

import os

# 使用import导入shutil模块

import shutil

# 将阿文的下载文件夹路径 /Users/yequ/Desktop 赋值给变量desktopPath

desktopPath = "/Users/yequ/Desktop"

# 使用os.listdir()函数获取该路径下所有的文件(夹),并赋值给变量allItems

allItems = os.listdir(desktopPath)

# 使用for循环遍历所有文件(夹)

for item in allItems:

    # 获取文件后缀名

    extension = os.path.splitext(item)[1].lower()

    # 定义一个变量targetPath,用来表示准备移动到的文件夹路径

    targetPath = ""

    if extension in [".jpg", ".jpeg", ".gif", ".png", ".bmp"]:

        # 使用os.path.join()函数拼接分类文件夹路径:图片文件

        # 并赋值给变量targetPath

        targetPath = os.path.join(desktopPath, "图片文件")

    elif extension in [".avi", ".mp4", ".wmv", ".mov", ".flv"]:

        # 使用os.path.join()函数拼接分类文件夹路径:视频文件

        # 并赋值给变量targetPath

        targetPath = os.path.join(desktopPath, "视频文件")

    elif extension in [".wav", ".mp3", ".mid", ".ape", ".flac"]:

        # 使用os.path.join()函数拼接分类文件夹路径:音频文件

        targetPath = os.path.join(desktopPath, "音频文件")

    elif extension in [".pdf"]:

        # 使用os.path.join()函数拼接分类文件夹路径:PDF文件

        targetPath = os.path.join(desktopPath, "PDF文件")

    elif extension in [".docx", ".doc"]:

        # 使用os.path.join()函数拼接分类文件夹路径:Word文件

        targetPath = os.path.join(desktopPath, "Word文件")

    elif extension in [".xlsx", ".xls"]:

        # 使用os.path.join()函数拼接分类文件夹路径:Excel文件

        targetPath = os.path.join(desktopPath, "Excel文件")

    elif extension in [".pptx", ".ppt"]:

        # 使用os.path.join()函数拼接分类文件夹路径:PPT文件

        targetPath = os.path.join(desktopPath, "PPT文件")

    else:

        # 使用os.path.join()函数拼接分类文件夹路径:其他文件

        targetPath = os.path.join(desktopPath, "其他文件")

    # 判断当如果目标文件夹不存在

    if not os.path.exists(targetPath):

        # 使用os.mkdir()函数创建文件夹

        os.mkdir(targetPath)

    # 使用os.path.join()函数拼接desktopPath和文件名

    # 并赋值给变量itemPath

    itemPath = os.path.join(desktopPath, item)

    # 判断当itemPath不是文件夹时。

    if not os.path.isdir(itemPath):

        # 使用shutil.move()函数移动文件到targetPath路径

        shutil.move(itemPath, targetPath)

http://www.tj-hxxt.cn/news/13026.html

相关文章:

  • wordpress特定用户特定分类seo页面链接优化
  • 河北省网站建设公司网址导航怎样推广
  • 找网络公司建网站的流程网站网址大全
  • 网站改版换域名seo sem是什么
  • 淘宝哪些做网站关键词排名的有用吗百度权重批量查询
  • 筑巢网站推广怎么样郑州百度推广seo
  • 手机网站排名优化口碑营销案例简短
  • 河源网站制作百度推广工作好干吗
  • wordpress 邮件服务求职seo服务
  • 做草坪绿化网站今日十大新闻
  • 晋中建设集团网站对网站提出的优化建议
  • 门户网站重要性免费长尾词挖掘工具
  • 帮别人做app网站门户的兼职网络推广最好的网站有哪些
  • 免费做网站tk百度推广代理
  • 个人网站开发教程百度收录平台
  • 游戏卡充值可以做网站吗市场营销在线课程
  • 网站后台模块广州网页seo排名
  • 网站目录怎么做外链seo优化与品牌官网定制
  • oa办公系统都有哪家临沂seo
  • 做dota2菠菜网站app推广工作是做什么的
  • 网站制作公司 沧州优化营商环境 助推高质量发展
  • 运营的网站域名查询
  • 有经验的合肥网站建设百度网盘下载
  • chci网站建设宁波seo服务快速推广
  • redhat7做网站过程seo是什么意思 为什么要做seo
  • 做网站的公司地址重庆网站关键词排名
  • 做企业网站有效果吗营销是什么意思
  • 潍坊 企业网站建设深圳网络推广公司哪家好
  • 做网站怎么导入地图seo是什么意思广东话
  • 做网站域名费向哪里交百度关键词怎么设置