Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
vikas pal
11,563 Pointsplease tell me briefly about 'from timestamp'
explain 'FROM' briefly to me please.why we use it and when we use it.what is it description. in which video of python they taught it.
1 Answer
Gianpaul Rachiele
4,844 PointsIf I understand your question correctly, you use the the keyword "from" to specify what package you're trying to import something from so let's say you want to import the ntlk package and use the function nltk.tokenize() instead of calling the function nltk.tokenize() you could import a specific function from a package using the from keyword.
i.e.
### Here you don't use the "from" keyword
import nltk
sentence = "Hello my name is Gianpaul"
nltk.word_tokenize(sentence)
### note that when you don't use the "from" keyword you need to specify "nltk" when calling the function
###########################################
### Here you use the "from" keyword
from nltk import word_tokenize
sentence = "Hello my name is Gianpaul"
word_tokenize(sentence)
### here you don't need to use "nltk" when calling the function
I hope this helps