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.