You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception:
Traceback (most recent call last):
File "C:\Users\lupn\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 43: invalid start byte
During handling of the above exception, another exception occurred:
命令行命令
python -v
python
exit()
或在windows中ctrl+z
然后回车。& python -m pip install -U yapf
vs code
安装pylint
出错参考:http://www.cnblogs.com/Loonger/p/7815335.html
错误:
分析是编码问题,直接修改
__init__.py
文件中第73行的utf-8
为gbk
。变量的命名规则
字符串
方法
title()
以首字母大写的方式显示每个单词upper()
,将字符串字母全部大写lower()
,将字符串字母全部小写rstrip()
,去除尾部空格lstrip()
,去除头部空格strip()
,去除首尾空格endswith()
,以指定字符串结尾整数
+-*/
加减乘除3**2
表示3的2次方str()
浮点数
带小数点的数统称为浮点数。
列表(数组)
arr.append()
,将元素附加到列表末尾arr.insert(index,element)
,在列表任何位置添加新元素del element
,从列表中删除元素arr.pop()
,删除列表末尾的元素,返回删除的元素arr.pop(index)
,删除指定下标的元素,返回删除的元素arr.remove(element)
,删除元素值arr.sort()
,对列表进行永久性排序,(按首字母)arr.sort(reverse=True)
,反排序sorted(arr)
,对列表进行临时排序,不会修改列表的值arr.reverse()
,反转列表len(arr)
,获取列表的长度列表解析
语法:
列表切片
语法:
arr[start:end]
数值列表
range(from,to,step)
,创建范围内的数字,前闭后开list(range(from,to))
,将range函数转为列表min(arr)
,求最小值max(arr)
,求最大值sum()
,求和元组
The text was updated successfully, but these errors were encountered: