摘要: class str(object): """ str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is spec... 阅读全文
posted @ 2017-01-25 22:48 ezway 阅读(375) 评论(0) 推荐(0)
摘要: s=' abcd ' s.lstrip() s.rstrip() s.strip() 只能去除两边的空格或者‘\n’ 阅读全文
posted @ 2017-01-25 22:21 ezway 阅读(152) 评论(0) 推荐(0)
摘要: a='alex' 有三种方式 1.help(type(a)) 2.dir(a) 3.type ctrl加鼠标左键找到str的类和内部所有方法 阅读全文
posted @ 2017-01-25 21:40 ezway 阅读(304) 评论(0) 推荐(0)
摘要: get() 可以指定值a.get('b','c') 若果没有指定值的话就会返回None pop(key,d) 跟字典一样移除值 如果k存在就抛出对应的值,如果k不在字典中就会并且给了d就会抛出d,否则就会keyerror a.values() a.items() a.keys() 显示所有的keys 阅读全文
posted @ 2017-01-25 21:01 ezway 阅读(139) 评论(0) 推荐(0)
摘要: temp='旺旺' temp_utf-8=temp.decode('utf-8') temp_gbk=temp_utf-8.encode('gbk') print(temp_gbk) 阅读全文
posted @ 2017-01-25 17:18 ezway 阅读(109) 评论(0) 推荐(0)