when running import nltk, Syntax Error is displayed [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
File "/Users/zineb/.local/lib/python2.7/site-packages/nltk/probability.py", line 333
print("%*s" % (width, samples[i]), end=" ")
^
SyntaxError: invalid syntax

You shouldn't be developing using python 2.7 anymore, 3.xx has been out for a long time and 2.x was EOL'd recently. Mac OS X has python3 installed as /usr/bin/python3.
To fix this error, you'll need to add from future import print_function at the top of /Users/zineb/.local/lib/python2.7/site-packages/nltk/probability.py.

Related

R programming equivalent of python spaCy 'spacy.explain()' [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
i was founding 'AUX'.
in python, i used 'spacy.explain('AUX')'. but, in R, i don't know the method.
You can use the R reticulate library to access Python.
Provided everything is installed correctly and Sys.which('python') points to the correct Python path for the spacy module:
library(reticulate)
sp <- import("spacy")
sp$explain("AUX")
[1] "auxiliary"

How to use Soundex() in googlecolab for python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I do coding using Python I tried to use soundex() in googlecolab by importing fuzzy . But I can not use . Pl. guide
You can add !pip install fuzzy before import fuzzy in colab and you should be able to use soundex()

How do I open an application using Python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
How do I open an app like Minecraft using os or subprocess? I went through a few videos and none of them worked. Do I just use the name of the app or its location?
For this example, you could use:
subprocess.run(r'"C:\path_to_minecraft\minecraft"',shell=True)
Or if you have Windows shortcuts you add the .lnk extension in the call:
subprocess.run(r'"C:\path_to_minecraft\minecraft.lnk"',shell=True)
this works.
import os
os.system("your app.exe")

How to call functions from other python files [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am working on a Python Project and want to call multiple functions from other python files, but I'm having trouble. Can someone please help me?
Each of your Python file can act as a module, that you can import.
for example for numpy you just type 'import numpy' and then you'll be able to use numpy.sin() function.
by default you can only append modules located in sys.path. So What you can do is:
import sys
if not (<folder_with_your_function> in sys.path):
sys.path.append( <folder_with_your_function> )
import <your_function>

Python Cmd Module Multi-line input [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
why the python Cmd module command prompt not using multi-line? it's over writing the same line
example image
I am sorry I don't know, hw to answer ques in stackoverflow, but I found it finally
use self.use_rawinput = False this will fix the problem (If you want a given stdin to be used, make sure to set the instance’s use_rawinput attribute to False, otherwise stdin will be ignored.)
https://docs.python.org/2/library/cmd.html

Categories