9951 explained code solutions for 126 technologies


pythonCount numbers of files in current directory


python -c "import os; print( len( os.listdir( os.getcwd() ) ) )"ctrl + c
-c

flag allows the execution of statements following the flag

import os

use os module

os.getcwd()

get path to current (working) directory

os.listdir(

list all contents of directory

len(

returns lengths of list in arguments