•        Python : 3.7.0
  •          OS : Ubuntu 18.04.1 LTS
  •         IDE : PyCharm 2018.2.4
  •       Conda : 4.5.11
  •    typesetting : Markdown

code

coder@Ubuntu:~$ source activate py37
(py37) coder@Ubuntu:~$ ipython
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import os In [2]: cd /home/coder/
/home/coder In [3]: ls -l
总用量 84
drwxr-xr-x 23 coder coder 4096 9月 30 18:41 anaconda3/
drwxr-xr-x 4 coder coder 4096 10月 2 11:57 Desktop/
drwxr-xr-x 2 coder coder 4096 10月 1 01:40 Documents/
drwxr-xr-x 2 coder coder 4096 10月 1 01:40 Downloads/
-rw-r--r-- 1 coder coder 8980 9月 30 17:26 examples.desktop
-rwxrwxr-x 1 coder coder 2354 4月 28 2009 get-fonts.sh*
-rw-rw-r-- 1 coder coder 1042 4月 28 2009 get-fonts.sh.zip
drwxr-xr-x 2 coder coder 4096 10月 1 01:40 Music/
drwxr-xr-x 3 coder coder 12288 10月 1 17:38 Pictures/
drwxr-xr-x 2 coder coder 4096 10月 1 01:40 Public/
drwxr-xr-x 11 coder coder 4096 9月 30 18:51 pycharm-2018.2.4/
drwxrwxr-x 5 coder coder 4096 10月 2 12:04 PycharmProjects/
drwxr-xr-x 3 coder coder 4096 9月 30 22:09 snap/
drwxr-xr-x 2 coder coder 4096 10月 1 01:40 Templates/
drwxr-xr-x 2 coder coder 4096 9月 30 18:51 ubuntu_software/
drwxr-xr-x 2 coder coder 4096 10月 1 01:40 Videos/ In [4]: os.listdir("/home/coder")
Out[4]:
['.presage',
'.sogouinput',
'snap',
'.ipython',
'.PyCharm2018.2',
'.vscode',
'Pictures',
'.dbus',
'.xinputrc',
'Downloads',
'.conda',
'get-fonts.sh.zip',
'Videos',
'.local',
'ubuntu_software',
'.mplayer',
'.thunderbird',
'.mozilla',
'examples.desktop',
'.bash_logout',
'.gconf',
'Music',
'.byobu',
'.gnupg',
'Desktop',
'pycharm-2018.2.4',
'.bash_history',
'.sudo_as_admin_successful',
'.config',
'Templates',
'.bashrc',
'get-fonts.sh',
'.python_history',
'PycharmProjects',
'Public',
'.pam_environment',
'.profile',
'.shutter',
'.thumbnails',
'.cache',
'Documents',
'.pki',
'.java',
'anaconda3',
'.gnome2',
'.ICEauthority'] In [5]: exit
(py37) coder@Ubuntu:~$ source deactivate
coder@Ubuntu:~$

resource

  • [文档] docs.python.org/3
  • [规范] www.python.org/dev/peps/pep-0008
  • [规范] zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules
  • [源码] www.python.org/downloads/source
  • [ PEP ] www.python.org/dev/peps
  • [平台] www.cnblogs.com
  • [平台] gitee.com


Python具有开源、跨平台、解释型、交互式等特性,值得学习。

Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。

代码的书写要遵守规范,这样有助于沟通和理解。

每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。

Python3基础 os listdir 列举指定的所有文件及文件夹的名字的更多相关文章

  1. Python3基础 os listdir curdir 查看当前工作目录的所有文件的名字

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  2. Python3基础 os listdir curdir pardir 查看工作目录及其上一级目录的所有文件名

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  3. Python3基础 os.path.basename 处理路径字符串,返回文件的名字

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  4. python3通过os模块统计指定目录下文件个数

    代码: import os path = r"C:\Users\Administrator\Desktop\***" print('filenum:',len([lists for ...

  5. Python3基础 os mkdirs 创建多层文件夹

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  6. Python3基础 list insert 在指定位置挤入一个元素

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  7. Python3基础 list count 查询指定元素在列表中出现了多少次

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  8. Python3基础 map+lambda 将指定系列元素乘2

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  9. Python3基础 str translate 将指定字符转换成另一种特定字符

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

随机推荐

  1. java 泛型没有协变类型, 所以要重用extends, 但使用List<? extends Fruit> 可以是ArrayList<Fruit>()、ArrayList<Apple>()、ArrayList<Orange>(), 因此不能add元素进去

    class Fruit{} class Apple extends Fruit{} class SubApple extends Apple{} class Orange extends Fruit{ ...

  2. ovs的主要代码函数及大体结构图

    作者: 北京-小武 邮箱:night_elf1020@163.com 新浪微博:北京-小武 最终抽时间把openvswitch的2.0代码看的思路汇总了下,因为是曾经好早下载的.看完了也才看到2.1依 ...

  3. cocos2d-x教程3:用php或DOS批处理命令来转换文件和解压缩zip

    在cocos2d-x使用中,须要不停的转换文件和压缩或解压文件.假设全人工来做,太麻烦了,且easy出错. 我如今把一些用的到批处理贴出来,供大家使用 自己主动把dat文件按数字排序重命名gz.DOS ...

  4. CentOS 6.5通过yum的方式安装MySql

    一.mysql简介 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库,咱 ...

  5. hiredis(Synchronous API)

    hiredis是一个小型的client端的c库.它只增加了最小对协议的支持,同时它用一个高级别的printf-alike API为了绑定各种redis命令.除了支持发送和接收命令,它还支持对流的解析. ...

  6. CentOS6.5安装RHadoop

    1.首先安装依赖包(各个节点都要安装) [root@Hadoop-NN-01 ~]$ yum install gcc-gfortran #否则报”configure: error: No F77 co ...

  7. MySQL--教程

    登入登出 首先启动服务,然后 mysql -u root -p 命令输入密码登入. mysql退出三种方法:mysql > exit;mysql > quit;mysql > \q;

  8. iOS 设计模式-委托模式

    委托是指给一个对象提供机会对另一对象中的变化做出反应或者相应另一个对象的行为.其基本思想是协同解决问题. Delegate的使用场合 对象A内部发生了一些事情,想通知对象B 对象B想监听对象A内部发生 ...

  9. Linux编译安装中configure、make和make install各自的作用

      这些都是典型的使用GNU的AUTOCONF和AUTOMAKE产生的程序的安装步骤. ./configure是用来检测你的安装平台的目标特征的.比如它会检测你是不是有CC或GCC,并不是需要CC或G ...

  10. EditPlus 4.3.2543 中文版已经发布(2月3日更新,Emmet 功能回归)

    新的 EditPlus 版本修复了 Emmet 组件的安全问题. 现在 Emmet 编辑功能又回来啦. 下载连接在页面左上角!