python--spring练习2
来源:互联网 发布:htc vive unity3d 编辑:程序博客网 时间:2024/05/18 01:19
#coding:utf-8# string clicea_string='my alpert starts where your alphabet ends.'print a_string[3:21]print a_string[0:2]print a_string[:18]print a_string[18:]#by = b'abcd\x65'print by #abcdeprint type (by) #<type 'str'>print len(by) #5#by += b'\xff'#print byprint by[0]barr = bytearray(by)print barr #abcde#常用的字符串方法s = ''' finish flies are the re0-sult of years of scientific ... study combined with the ... experice of yeaer.. '''s.splitlines()print s.splitlines() ##r多行输入作为参数,返回一个字符串列表,列表的元素是原来的单行字符串print s.upper()print s.upper().count('F')query = 'user=test&database=master&password=123456'a_list = query.split('&')print a_list #['user=test', 'database=master', 'password=123456']a_list_of_lists=[v.split('=',1) for v in a_list] print a_list_of_lists #[['user', 'test'], ['database', 'master'], ['password', '123456']]a_dict = dict(a_list_of_lists) print a_dict #{'password': '123456', 'user': 'test', 'database': 'master'}
阅读全文
0 0
- python--spring练习2
- Python 练习2
- python game练习2
- 【python练习】2
- python基础练习2
- python基础练习2
- python练习2
- Python 练习实例2
- Python练习2
- Python练习实例2
- python练习2
- Python练习题目2
- Python基础练习2
- python基础2练习
- python练习2
- python爬虫练习2
- python简单练习2
- python 练习2
- Tomcat端口(8005,8009,8080)被占用:starting Tomcat8.0 server at localhost has encountered a problem
- 蓝桥杯决赛----密文搜索
- 关于A*算法
- [离散化+线段树] POJ
- Java FileReader类和FileWriter类的运用
- python--spring练习2
- 反思管理上的说教
- Spring定时任务
- 一些调侃编程之难
- gson null 空值不转换问题
- Python yield 使用浅析
- hidesBottomBarWhenPushed隐藏底部TabBar时push的VC出现白色遮挡问题
- Focus on Small Steps First, Then Shift to the Larger Goal
- RMQ 的ST算法 【模版】+【知识点】