Home > other >  The old man ask a question, Python's string of judgment
The old man ask a question, Python's string of judgment

Time:10-12

I now have about ten million string, encoding to utf-8, the length of each of the one hundred bytes, now want a quick judgment method, select all is full of English string or string containing Chinese characters, I want a function that can realize a line in the following two functions: first: judgment string is full of English letters; The second: determine string contains Chinese characters, can you tell me which one is more easy to implement, faster ah

CodePudding user response:

I think with re English faster,

CodePudding user response:

Re directly determine whether there is a Chinese went inside, not in English must be Chinese, if determine whether is difficult to handle in English punctuation marks

CodePudding user response:

Determine the ASCII too hardware consumption, as long as there is a Chinese judge whether stop judging efficiency is much higher

CodePudding user response:

[\ u4E00 - \ u9FA5] with the match
  • Related