0

I am new to python programming.I want to give Hindi string as an input to a variable in python as:

a='शिक्षा का अधिकार अधिनियम'

On writing this on command prompt I get an error message as

'Unsupported characters in input'

I am using Python 2.7 on windows.Can anyone suggest how to get rid of this problem

Pratibha
  • 11
  • 1
  • 2
    You can get rid of it by upgrading to Python 3.5 or above. – Burhan Khalid Mar 29 '17 at 11:21
  • 1
    You need an alternative shell. Take a look at [this](http://stackoverflow.com/questions/2105022/unicode-in-powershell-with-python-alternative-shells-in-windows) – abhi Mar 29 '17 at 11:21
  • 1
    All strings in Python 3.5 are automatically set to Unicode. – abhi Mar 29 '17 at 11:22
  • check this it worked fine with python 3.5 http://pasteboard.co/PtbzeLBTG.png it also worked fine with python 2.7.13 https://ibb.co/ez5jyv – Aman Tandon Mar 30 '17 at 02:06
  • I am also using python 2.7.13 with nltk3.2.2, but still its not working@Aman Tandon – Pratibha Mar 30 '17 at 05:32
  • thanks...my problem is resolved. But now I am facing another problem. I have two files. from 'word.txt' I am reading strings and want to count occurrence of that word in another file 'document.txt'. The code is as follows:wordcount=0 with codecs.open('word.txt') as p: keyword=p.read() with codecs.open('document.txt') as f: for line in f.readlines(): for word in line.split(): if word==keyword: wordcount+=1 print wordcount – Pratibha Mar 31 '17 at 10:18

0 Answers0