how to display the return type of an os method?

Discussion in 'Python' started by Bruno Desthuilliers, Nov 7, 2009.

  1. Robert P. J. Day a écrit :
    > once again, a thoroughly newbie question but what's the quickest way
    > to display the return type of, say, os.stat()? i can obviously do
    > this in two steps:
    >
    >>>> x=os.stat('/etc/passwd')
    >>>> type(x)

    > <class 'posix.stat_result'>
    >
    > i'd just like to see that os.stat() returns a posix.stat_result
    > object in one line.


    => type(os.stat('/etc/passwd'))

    But reading the doc might help too:

    => help(os.stat)
     
    Bruno Desthuilliers, Nov 7, 2009
    #1
    1. Advertising

  2. once again, a thoroughly newbie question but what's the quickest way
    to display the return type of, say, os.stat()? i can obviously do
    this in two steps:

    >>> x=os.stat('/etc/passwd')
    >>> type(x)

    <class 'posix.stat_result'>
    >>>


    i'd just like to see that os.stat() returns a posix.stat_result
    object in one line. how dumb a question is that?

    rday
    --

    ========================================================================
    Robert P. J. Day Waterloo, Ontario, CANADA

    Linux Consulting, Training and Kernel Pedantry.

    Web page: http://crashcourse.ca
    Twitter: http://twitter.com/rpjday
    ========================================================================
     
    Robert P. J. Day, Nov 7, 2009
    #2
    1. Advertising

  3. On Sat, 7 Nov 2009, Bruno Desthuilliers wrote:

    > Robert P. J. Day a écrit :
    > > once again, a thoroughly newbie question but what's the quickest way
    > > to display the return type of, say, os.stat()? i can obviously do
    > > this in two steps:
    > >
    > >>>> x=os.stat('/etc/passwd')
    > >>>> type(x)

    > > <class 'posix.stat_result'>
    > >
    > > i'd just like to see that os.stat() returns a posix.stat_result
    > > object in one line.

    >
    > => type(os.stat('/etc/passwd'))
    >
    > But reading the doc might help too:
    >
    > => help(os.stat)


    never mind, i realize now it was a dumb question since the return
    type is based on the routine logic, of course. argh. carry on.

    rday
    --

    ========================================================================
    Robert P. J. Day Waterloo, Ontario, CANADA

    Linux Consulting, Training and Kernel Pedantry.

    Web page: http://crashcourse.ca
    Twitter: http://twitter.com/rpjday
    ========================================================================
     
    Robert P. J. Day, Nov 7, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Howard
    Replies:
    2
    Views:
    387
    Michiel Salters
    Jul 4, 2003
  2. Rolf Magnus
    Replies:
    1
    Views:
    338
    ding feng
    Jul 4, 2003
  3. Greenhorn
    Replies:
    15
    Views:
    868
    Keith Thompson
    Mar 6, 2005
  4. andrew cooke
    Replies:
    1
    Views:
    191
    Steven D'Aprano
    Apr 3, 2011
  5. Xeno Campanoli
    Replies:
    0
    Views:
    242
    Xeno Campanoli
    Feb 13, 2006
Loading...

Share This Page