Python基础学习-1

 

       Linux命令基本命令:

 ls(list);pwd(print work directory);cd(change directory);whoami(who am i);顾名思义

    本节知识点

1 数值类型  int; float(不精确;decimal精确计算。例:decimal.Decimal('2.2'));bool;complex  +;-;*;/;//取整;%取余;**幂;

2 序列类型  list(切片,例:list0[1:6:2]);tuple(拆包,例:a, *b, c = tuple0)

3 序列类型的通用操作

列表:增:append();  insert();  extend();  删:pop();  remove();  clear();  del 内置函数;  查看:index;  count();  dir()查看方法;  其他:type() 类型;  copy()复制;  reverse()反向;sort()排序;

字符串:查看:count()  find()  index()  isdigit()  isalpha()  endswith()  startswith()  islower()  isupper()  改:upper()  lower()  strip(lstrip, rstrip)  capitalize()  title()  split()

    删除:replace()  增:字符串的拼接 +;  ' '.join([str1, str2, str3]);

    使用format:  '{}{}{}'.format(obj1, obj2, obj3)  '{0}{1}{2}'.format(obj1, obj2, obj3)  '{n1}{n2}{n3}'.format(n1 = obj1, n2 = obj2, n3 = obj3)  %s

字符串的转义:r' ' ->不转义;  \n  \t  \b  \r  \\  \'  \0代表一个空字符  \a系统提示音

元组:  查看:  count()  index()

 

posted @ 2018-09-15 14:43  liubosong  阅读(99)  评论(0)    收藏  举报