How can I determine which arguments a Python function takes? [duplicate]












1















This question already has an answer here:




  • Getting the docstring from a function

    3 answers




Running the following code:



pdf = pdftotext.PDF(f,layout='raw')


produced this error:




'layout' is an invalid keyword argument for this function




Is there a way to list which arguments this, and any, function would take?










share|improve this question













marked as duplicate by tripleee, sideshowbarker, jww, stovfl, EdChum python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 12 '18 at 9:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 3




    print(help(pdftotext.PDF)).
    – Torxed
    Nov 12 '18 at 7:09










  • Are you using an IDE?
    – LonelyCpp
    Nov 12 '18 at 7:15
















1















This question already has an answer here:




  • Getting the docstring from a function

    3 answers




Running the following code:



pdf = pdftotext.PDF(f,layout='raw')


produced this error:




'layout' is an invalid keyword argument for this function




Is there a way to list which arguments this, and any, function would take?










share|improve this question













marked as duplicate by tripleee, sideshowbarker, jww, stovfl, EdChum python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 12 '18 at 9:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 3




    print(help(pdftotext.PDF)).
    – Torxed
    Nov 12 '18 at 7:09










  • Are you using an IDE?
    – LonelyCpp
    Nov 12 '18 at 7:15














1












1








1








This question already has an answer here:




  • Getting the docstring from a function

    3 answers




Running the following code:



pdf = pdftotext.PDF(f,layout='raw')


produced this error:




'layout' is an invalid keyword argument for this function




Is there a way to list which arguments this, and any, function would take?










share|improve this question














This question already has an answer here:




  • Getting the docstring from a function

    3 answers




Running the following code:



pdf = pdftotext.PDF(f,layout='raw')


produced this error:




'layout' is an invalid keyword argument for this function




Is there a way to list which arguments this, and any, function would take?





This question already has an answer here:




  • Getting the docstring from a function

    3 answers








python function arguments pdftotext






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 7:04









Jack Putter

328




328




marked as duplicate by tripleee, sideshowbarker, jww, stovfl, EdChum python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 12 '18 at 9:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by tripleee, sideshowbarker, jww, stovfl, EdChum python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 12 '18 at 9:11


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 3




    print(help(pdftotext.PDF)).
    – Torxed
    Nov 12 '18 at 7:09










  • Are you using an IDE?
    – LonelyCpp
    Nov 12 '18 at 7:15














  • 3




    print(help(pdftotext.PDF)).
    – Torxed
    Nov 12 '18 at 7:09










  • Are you using an IDE?
    – LonelyCpp
    Nov 12 '18 at 7:15








3




3




print(help(pdftotext.PDF)).
– Torxed
Nov 12 '18 at 7:09




print(help(pdftotext.PDF)).
– Torxed
Nov 12 '18 at 7:09












Are you using an IDE?
– LonelyCpp
Nov 12 '18 at 7:15




Are you using an IDE?
– LonelyCpp
Nov 12 '18 at 7:15












3 Answers
3






active

oldest

votes


















0














Use the help built-in function of python.




help([object])



Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the
interactive help system starts on the interpreter console. If the
argument is a string, then the string is looked up as the name of a
module, function, class, method, keyword, or documentation topic, and
a help page is printed on the console. If the argument is any other
kind of object, a help page on the object is generated.




Let's say you are coming from Python 2.7 and need help with the print function of Python 3. Go to the interactive prompt and type help(print):



>>> help(print)



   Help on built-in function print in module builtins:

print(...)
print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
(END)



As you can see print takes 4 keyword arguments (sep, end, file, flush). Press q when you are done to exit.






share|improve this answer































    1














    help(f) shows documentation and parameters for a python construct f, like a class or function.



    Eg on the console




    help(print)



    shows




    Help on built-in function print in module builtins:

    print(...)
    print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

    Prints the values to a stream, or to sys.stdout by default.
    Optional keyword arguments:
    file: a file-like object (stream); defaults to the current sys.stdout.
    sep: string inserted between values, default a space.
    end: string appended after the last value, default a newline.
    flush: whether to forcibly flush the stream.



    Help on my new function f ...




    def f():
    None



    shows




    Help on function f in module main:



    f()




    https://docs.python.org/3/library/functions.html#help






    share|improve this answer





















    • This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
      – Jack Putter
      Nov 12 '18 at 7:55





















    -1














    help function in python can be used to view the documentation for a class or a function. I like to keep an IPython interpreter running when coding in python. IPython provides operators like ? and ?? specifically for this purpose.






    share|improve this answer




























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Use the help built-in function of python.




      help([object])



      Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the
      interactive help system starts on the interpreter console. If the
      argument is a string, then the string is looked up as the name of a
      module, function, class, method, keyword, or documentation topic, and
      a help page is printed on the console. If the argument is any other
      kind of object, a help page on the object is generated.




      Let's say you are coming from Python 2.7 and need help with the print function of Python 3. Go to the interactive prompt and type help(print):



      >>> help(print)



         Help on built-in function print in module builtins:

      print(...)
      print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

      Prints the values to a stream, or to sys.stdout by default.
      Optional keyword arguments:
      file: a file-like object (stream); defaults to the current sys.stdout.
      sep: string inserted between values, default a space.
      end: string appended after the last value, default a newline.
      flush: whether to forcibly flush the stream.
      (END)



      As you can see print takes 4 keyword arguments (sep, end, file, flush). Press q when you are done to exit.






      share|improve this answer




























        0














        Use the help built-in function of python.




        help([object])



        Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the
        interactive help system starts on the interpreter console. If the
        argument is a string, then the string is looked up as the name of a
        module, function, class, method, keyword, or documentation topic, and
        a help page is printed on the console. If the argument is any other
        kind of object, a help page on the object is generated.




        Let's say you are coming from Python 2.7 and need help with the print function of Python 3. Go to the interactive prompt and type help(print):



        >>> help(print)



           Help on built-in function print in module builtins:

        print(...)
        print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

        Prints the values to a stream, or to sys.stdout by default.
        Optional keyword arguments:
        file: a file-like object (stream); defaults to the current sys.stdout.
        sep: string inserted between values, default a space.
        end: string appended after the last value, default a newline.
        flush: whether to forcibly flush the stream.
        (END)



        As you can see print takes 4 keyword arguments (sep, end, file, flush). Press q when you are done to exit.






        share|improve this answer


























          0












          0








          0






          Use the help built-in function of python.




          help([object])



          Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the
          interactive help system starts on the interpreter console. If the
          argument is a string, then the string is looked up as the name of a
          module, function, class, method, keyword, or documentation topic, and
          a help page is printed on the console. If the argument is any other
          kind of object, a help page on the object is generated.




          Let's say you are coming from Python 2.7 and need help with the print function of Python 3. Go to the interactive prompt and type help(print):



          >>> help(print)



             Help on built-in function print in module builtins:

          print(...)
          print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

          Prints the values to a stream, or to sys.stdout by default.
          Optional keyword arguments:
          file: a file-like object (stream); defaults to the current sys.stdout.
          sep: string inserted between values, default a space.
          end: string appended after the last value, default a newline.
          flush: whether to forcibly flush the stream.
          (END)



          As you can see print takes 4 keyword arguments (sep, end, file, flush). Press q when you are done to exit.






          share|improve this answer














          Use the help built-in function of python.




          help([object])



          Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the
          interactive help system starts on the interpreter console. If the
          argument is a string, then the string is looked up as the name of a
          module, function, class, method, keyword, or documentation topic, and
          a help page is printed on the console. If the argument is any other
          kind of object, a help page on the object is generated.




          Let's say you are coming from Python 2.7 and need help with the print function of Python 3. Go to the interactive prompt and type help(print):



          >>> help(print)



             Help on built-in function print in module builtins:

          print(...)
          print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

          Prints the values to a stream, or to sys.stdout by default.
          Optional keyword arguments:
          file: a file-like object (stream); defaults to the current sys.stdout.
          sep: string inserted between values, default a space.
          end: string appended after the last value, default a newline.
          flush: whether to forcibly flush the stream.
          (END)



          As you can see print takes 4 keyword arguments (sep, end, file, flush). Press q when you are done to exit.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 12 '18 at 8:11

























          answered Nov 12 '18 at 7:23









          Ayxan

          1,520115




          1,520115

























              1














              help(f) shows documentation and parameters for a python construct f, like a class or function.



              Eg on the console




              help(print)



              shows




              Help on built-in function print in module builtins:

              print(...)
              print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

              Prints the values to a stream, or to sys.stdout by default.
              Optional keyword arguments:
              file: a file-like object (stream); defaults to the current sys.stdout.
              sep: string inserted between values, default a space.
              end: string appended after the last value, default a newline.
              flush: whether to forcibly flush the stream.



              Help on my new function f ...




              def f():
              None



              shows




              Help on function f in module main:



              f()




              https://docs.python.org/3/library/functions.html#help






              share|improve this answer





















              • This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
                – Jack Putter
                Nov 12 '18 at 7:55


















              1














              help(f) shows documentation and parameters for a python construct f, like a class or function.



              Eg on the console




              help(print)



              shows




              Help on built-in function print in module builtins:

              print(...)
              print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

              Prints the values to a stream, or to sys.stdout by default.
              Optional keyword arguments:
              file: a file-like object (stream); defaults to the current sys.stdout.
              sep: string inserted between values, default a space.
              end: string appended after the last value, default a newline.
              flush: whether to forcibly flush the stream.



              Help on my new function f ...




              def f():
              None



              shows




              Help on function f in module main:



              f()




              https://docs.python.org/3/library/functions.html#help






              share|improve this answer





















              • This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
                – Jack Putter
                Nov 12 '18 at 7:55
















              1












              1








              1






              help(f) shows documentation and parameters for a python construct f, like a class or function.



              Eg on the console




              help(print)



              shows




              Help on built-in function print in module builtins:

              print(...)
              print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

              Prints the values to a stream, or to sys.stdout by default.
              Optional keyword arguments:
              file: a file-like object (stream); defaults to the current sys.stdout.
              sep: string inserted between values, default a space.
              end: string appended after the last value, default a newline.
              flush: whether to forcibly flush the stream.



              Help on my new function f ...




              def f():
              None



              shows




              Help on function f in module main:



              f()




              https://docs.python.org/3/library/functions.html#help






              share|improve this answer












              help(f) shows documentation and parameters for a python construct f, like a class or function.



              Eg on the console




              help(print)



              shows




              Help on built-in function print in module builtins:

              print(...)
              print(value, ..., sep=' ', end='n', file=sys.stdout, flush=False)

              Prints the values to a stream, or to sys.stdout by default.
              Optional keyword arguments:
              file: a file-like object (stream); defaults to the current sys.stdout.
              sep: string inserted between values, default a space.
              end: string appended after the last value, default a newline.
              flush: whether to forcibly flush the stream.



              Help on my new function f ...




              def f():
              None



              shows




              Help on function f in module main:



              f()




              https://docs.python.org/3/library/functions.html#help







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 12 '18 at 7:16









              Adam Burke

              445




              445












              • This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
                – Jack Putter
                Nov 12 '18 at 7:55




















              • This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
                – Jack Putter
                Nov 12 '18 at 7:55


















              This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
              – Jack Putter
              Nov 12 '18 at 7:55






              This works scripted but the command line gives me this error: 'NameError: name 'pdftotext' is not defined.' UPDATE: Apologies, it wasn't imported...
              – Jack Putter
              Nov 12 '18 at 7:55













              -1














              help function in python can be used to view the documentation for a class or a function. I like to keep an IPython interpreter running when coding in python. IPython provides operators like ? and ?? specifically for this purpose.






              share|improve this answer


























                -1














                help function in python can be used to view the documentation for a class or a function. I like to keep an IPython interpreter running when coding in python. IPython provides operators like ? and ?? specifically for this purpose.






                share|improve this answer
























                  -1












                  -1








                  -1






                  help function in python can be used to view the documentation for a class or a function. I like to keep an IPython interpreter running when coding in python. IPython provides operators like ? and ?? specifically for this purpose.






                  share|improve this answer












                  help function in python can be used to view the documentation for a class or a function. I like to keep an IPython interpreter running when coding in python. IPython provides operators like ? and ?? specifically for this purpose.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 12 '18 at 7:14









                  saga

                  512315




                  512315















                      Popular posts from this blog

                      Full-time equivalent

                      さくらももこ

                      13 indicted, 8 arrested in Calif. drug cartel investigation