This question already has answers here:
How do I download NLTK data?
(15 answers)
Closed 3 years ago.
I'm trying to download all the nltk packages :
import nltk
nltk.download()
But the GUI don't open.
This is what appears instead :
NLTK Downloader
---------------------------------------------------------------------------
d) Download l) List u) Update c) Config h) Help q) Quit
---------------------------------------------------------------------------
When I type d I can see the list of available packages but I'm not offered to download them.
How can I open the GUI, or how can I download them all from the console ? Thanks.
Try
nltk.download('all')
this will download all the data and no need to download individually.
Related
This question already has answers here:
Set up Python 3 build system with Sublime Text 3
(10 answers)
Closed 11 months ago.
Need help installing python on the sublime text on a windows laptop. I am new to this and spent hours online looking but nothing worked.
I tried
tools>build system>new build system and entered
"cmd":["python3","-u","$file"],
but it does not work, it shows this message
C:\Users\john\AppData\Local\Programs\Python\Python310\python.exe: can't find '__main__' module in ''
[Finished in 12.3s]
Try to go to Tools > Build System and select Python. That should work.
You can just do CTRL + B to run the file.
This question already has answers here:
Getting error when using pynput with pyinstaller
(2 answers)
Closed 8 months ago.
Hey ive tried coding a script in which i use pynput to detect keybinds being pressed. It works fine itself but sadly once i try to use pyinstaller to make it into an exe file the following error pops up once i try to run it.
I have tried looking up the problem but have not found any working solutions.
I have also read through pyinstaller's documentation but I didn't find anything.
#use this pip install pynput==1.6.8
This question already has answers here:
How can I use cookies in Python Requests?
(4 answers)
Using Kaggle Datasets in Google Colab
(13 answers)
Closed 4 years ago.
UPDATE: It looks like the link requires a log in, I updated the title.
This is a link for a particular Kaggle data file that I'm trying to download into Python (Google Colab if it makes a difference)
This is the link
https://www.kaggle.com/azathoth42/myanimelist/downloads/UserAnimeList.csv/9
Which I got from here
https://www.kaggle.com/azathoth42/myanimelist#UserAnimeList.csv
I tried using wget with the following code
!pip install wget
!wget -i https://www.kaggle.com/azathoth42/myanimelist/downloads/UserAnimeList.csv/9
Which didn't seem to work
I then tried
from urllib import request
request.urlretrieve('https://www.kaggle.com/azathoth42/myanimelist/downloads/UserAnimeList.csv/9' , 'download.zip')
The issue I now know is that it requires a log in.
Edit:
This link shows how to download Kaggle data into colab complete with an example notebook
Using kaggle datasets into Google Colab
This question already has answers here:
How to extract text from a PDF file?
(33 answers)
Closed 5 years ago.
How can I read pdf in python?
I know one way of converting it to text, but I want to read the content directly from pdf.
Can anyone explain which module in python is best for pdf extraction
You can USE PyPDF2 package
# install PyPDF2
pip install PyPDF2
Once you have it installed:
# importing all the required modules
import PyPDF2
# creating a pdf reader object
reader = PyPDF2.PdfReader('example.pdf')
# print the number of pages in pdf file
print(len(reader.pages))
# print the text of the first page
print(reader.pages[0].extract_text())
Follow the documentation.
You can use textract module in python
Textract
for install
pip install textract
for read pdf
import textract
text = textract.process('path/to/pdf/file', method='pdfminer')
For detail Textract
This question already has answers here:
How to find "import name" of any package in Python?
(5 answers)
Closed 5 years ago.
I am doing a python webpage scraper .
Some tutorial told me to use this package: BeautifulSoup. So I installed it using pip.
Then, in my script, I try to import BeautifulSoup as bs. But I was warned that no module named BeautifulSoup.
Is there a reliable way to get module name out of an installed package?
Try this from bs4 import BeautifulSoup
Edit: Was already answered by #jonsharpe and #VinÃcius Aguiar in the comments under the question.