字符串中查找字母有几个
2016-07-21 20:23
288 查看
p = 0 s = 'How can i get there?' for i in s: if i == 'P'or i == 'p': p = p + 1 else: continue if p != 0: print('有',p,'个') else: print('无')
相关文章推荐
- 个人学习博客1
- Uncowed Forces
- DOM—动态添加table
- 两个大的整数的运算(java)
- Hotel
- Notification
- NYOJ 330 一个简单的数学题【思维】
- HDU 1241 Oil Deposits 油田 搜索
- Restaurant
- Hibernate中,One2Many和Many2One的双向映射关系的XML实现方式
- 用slf4j+logback实现多功能日志解决方案 --- 转
- linker command failed with exit code 1 (use -v to see invocation)
- linker command failed with exit code 1 (use -v to see invocation)
- HDU 4268-Alice and Bob-贪心
- ifconfig command not found
- 告诉你一个java对象占用的内存大小的方法
- 引用传递&值传递
- 项目打包版本号维护
- 一个二分类的例子
- MySQL学习笔记(四)—存储过程