美文网首页
三分钟热情自学 Python · 第11期 · 使用 Pytho

三分钟热情自学 Python · 第11期 · 使用 Pytho

作者: 游文影月志 | 来源:发表于2020-09-05 15:42 被阅读0次

    博观而约取,厚积而薄发。
    ——苏轼

    1. 前言

    在这个生活中处处都是大数据和人工智能的时代,总是能在各种角落看到 Python 的培训广告。我招架不住敌方的猛烈攻势,败下阵来。经过了一分钟的深思熟虑,我决定利用我的三分钟热情进行回击,从零开始自学 Python

    2.

    File Paths

    文件路径

    File paths in different operating system:
    不同操作系统中的文件路径:

    • Windows:
      Use the backslashes (\) as the path separator.
      使用反斜杠 \ 作为路径分隔符。
      C:\Users\python

    • macOS & Linux:
      Use the forward slash (/) as the path separator.
      使用正斜杠 / 作为路径分隔符。
      /home/python/

    2.1

    Use pathlib to Deal with File Paths

    使用 pathlib 处理文件路径

    Always use forward slashes with pathlib functions is a good idea. The Path() object will convert forward slashes into the correct kind of slash for the current operating system.

    在使用 pathlib 模块的函数时,最好一直都采用正斜杠作为分隔符。Path() 对象会将正斜杠转换为当前操作系统所对应的斜杠类型。

    相关文章

      网友评论

          本文标题:三分钟热情自学 Python · 第11期 · 使用 Pytho

          本文链接:https://www.haomeiwen.com/subject/uokfektx.html