SYSTEM

OS functions

How to create and list a folder in python ?

Jeffrin
$python3.7
Python 3.7.4 (default, Jul 11 2019, 10:43:21) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir('.')
[]
>>> os.mkdir('newfolder')
>>> os.listdir('.')
['newfolder']
>>> 

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top