1

I come from C background, in C whenever I want to see the documentation for something I just do man 3 thing e.g.:

$ man 3 open
NAME
       open, openat — open file relative to directory file descriptor

SYNOPSIS
       #include <sys/stat.h>
       #include <fcntl.h>

       int open(const char *path, int oflag, ...);
       int openat(int fd, const char *path, int oflag, ...);

I was wondering if Python also had something like this.

ladybug
  • 323
  • 1
  • 4
  • 9

1 Answers1

1

Good question!

Yes python has that too, it's even interactive, just open a python shell in your terminal by running python.

Then type:

help(open)

You will get this back:

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
    Open file and return a stream.  Raise OSError upon failure.

    file is either a text or byte string giving the name (and the path
    if the file isn't in the current working directory) of the file to
    be opened or an integer file descriptor of the file to be
    wrapped. (If a file descriptor is given, it is closed when the
    returned I/O object is closed, unless closefd is set to False.)
.
.
.

Which is exactly like the manpages in C.

Also don't forget help(help) for more info ;)

yukashima huksay
  • 5,834
  • 7
  • 45
  • 78