kabir123123123
kabir123123123

Reputation: 31

what is the equivalent of ls() function of r in python?

Basically what ls() does in r is that it is used to list the names of all the objects that are present in the working directory. I want to do the same in python, could someone please help me with this ? I'm a python newbie ;-;

Upvotes: 3

Views: 4697

Answers (1)

Sharim09
Sharim09

Reputation: 6224

you can use os.listdir()

import os

print(os.listdir('.')) # here '.' for current directory.

Upvotes: 2

Related Questions