随笔分类 -  Python

摘要:路径和文件名不要有中文 #!/usr/bin/env python #-*- coding:utf-8 -*- 2.7需要加此行。3.5不用 版本区别: python3.5 print('hello,world') 默认utf-8 input("请输入名字") utf-8转换gbk: decode( 阅读全文
posted @ 2017-06-14 19:30 hijacklinux 阅读(255) 评论(0) 推荐(0)
摘要:字符串是一个类,"hello world"是它的对象 常用方法: 移除空白 分割 长度 索引 切片 class str(basestring): def capitalize(self): """ 首字母变大写 """ (返回副本) def center(self, width, fillchar= 阅读全文
posted @ 2017-06-07 02:46 hijacklinux 阅读(224) 评论(0) 推荐(0)