Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
为什么 unicode 的中文字符串,调用 isalpha()或 isalnum()返回的是 True 呢?
ffxung
·
Oct 20, 2014
· 6569 views
This topic created in 4249 days ago, the information mentioned may be changed or developed.
例如:
s = u"中国"
print s.isalpha()
输出竟然为True. 这是什么原因?
那么想判断字符串是否只有字母组成出了正则,还有什么好方法?
字符串
调用
s.isalpha
2 replies
•
2014-10-21 10:37:55 +08:00
1
messense
Oct 20, 2014
先转成 str 貌似可以...
2
qdcanyun
Oct 21, 2014
试试s.encode('utf-8').isalpha()
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
5435 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 39ms ·
UTC 08:13
·
PVG 16:13
·
LAX 01:13
·
JFK 04:13
♥ Do have faith in what you're doing.
❯