0

I'm using XAMPP on Windows 10. I create this code below and run it on localhost:

#!C:/python/python.exe

print("Content-Type: text/html\n")
print("test")

from nltk.tokenize import sent_tokenize, word_tokenize
example_text = "Hello there, how are you doing today? I'm fine."
print(sent_tokenize(example_text))

The result from localhost:

test

It's not the result should be. When I run the codes using python shell, it has this output:

Content-Type: text/html

test
['Hello there, how are you doing today?', "I'm fine."] //this line should be shown in localhost

It seems like xampp cannot import the package, so it cannot use 'sent_tokenize' function to the 'example_text'. How to solve this?

I just want to run python on web browser, any solution will be accepted.

Kevin A.S.
  • 123
  • 7
  • The answers to [this question](https://stackoverflow.com/questions/42704846/running-python-scripts-with-xampp) should help you out. – Finlay McAfee Jun 04 '19 at 15:26
  • I had read that question too before. I can connecting python with xampp using that guide. That's why my codes above can produce 'test' text. However my codes above still cannot include python libraries when I run it in localhost. – Kevin A.S. Jun 04 '19 at 15:33

0 Answers0