Is there something like head() and str() of R in python?

Peng Yu pengyu.ut at gmail.com
Sun Nov 19 14:04:43 EST 2017


Hi, R has the functions head() and str() to show the brief content of
an object. Is there something similar in python for this purpose?

For example, I want to inspect the content of the variable "train".
What is the best way to do so? Thanks.

$ cat demo.py
from __future__ import division, print_function, absolute_import

import tflearn
from tflearn.data_utils import to_categorical, pad_sequences
from tflearn.datasets import imdb

# IMDB Dataset loading
train, test, _ = imdb.load_data(path='imdb.pkl', n_words=10000,
                                valid_portion=0.1)

# https://raw.githubusercontent.com/llSourcell/How_to_do_Sentiment_Analysis/master/demo.py

-- 
Regards,
Peng



More information about the Python-list mailing list