Advertisement
here2share

# string_true_if_all_in_Eng_context.py

Aug 11th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # the line above needs to be at top of the python file, otherwise an error may result about encoding
  3.  
  4. # string_true_if_all_in_Eng_context.py
  5.  
  6. def isEnglish(s):
  7.     try:
  8.         s.decode('ascii')
  9.     except UnicodeDecodeError:
  10.         return 'F : '+s
  11.     else:
  12.         return 'T : '+s
  13.  
  14. print isEnglish('slabiky, ale liší se podle významu')
  15. print isEnglish('This entire string is in English?')
  16. print isEnglish('ގެ ފުރަތަމަ ދެ އަކުރު ކަ')
  17. print isEnglish('how about this one : 通 asfަ')
  18. print isEnglish('123abc!@#$%^&*()[]{}=_-><.:\\/~+ ???')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement