Python
学习Python的一些记录
Magical-E
这个作者很懒,什么都没留下…
展开
-
【报错记录】powershell自动激活conda环境
在命令行输入python出现“Warning:This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. To activate this environment please see https://conda...原创 2020-03-20 23:26:20 · 11655 阅读 · 17 评论 -
【报错记录】Python文件读取时报错FileNotFoundError: [Errno 2] No such file or directory: ‘xxx‘
使用Python打开文件时:fh = open('mbox.txt')如果显示报错:FileNotFoundError: [Errno 2] No such file or directory: 'mbox.txt'则可能和编辑器的工作区有关。例如我使用的是VSCode,会以打开的整个文件夹Python为工作区,文件的路径默认相对工作区,而不是py文件。报错时文件的分布为:Python├── Using Databases with Python│ ├── Week-1│ ├─原创 2020-10-05 08:21:03 · 7177 阅读 · 7 评论 -
【学习记录】Python-HTML
【学习记录】HTMLHTML Tag格式标准:在opening tag中添加attribute时需要空格。tag的内容在opening tag和closing tag之间填写;若tag之间不包含内容,则不填写任何内容即可,不允许XML中的self-closing语法。<p>:p全称paragraph,用于创建段落<div>:div全称division,用于创建区块<ol>&<li>:ol全称ordered list,用于创建有序列表ul原创 2020-10-24 11:33:47 · 555 阅读 · 0 评论 -
【学习记录】Python-Selenium
【学习记录】Python-Selenium准备软件chromedriver : http://chromedriver.storage.googleapis.com/index.htmlgeckdriver:https://github.com/mozilla/geckodriver安装pip install seleniumchromedriver复制到Google\Chrome\Application、Anaconda3\文件夹下,并且添加系统环境变量检测安装from selenium原创 2020-10-24 11:29:49 · 217 阅读 · 0 评论 -
【学习记录】Python-Regular Expression
【学习记录】Python-Regular Expression基本用法re.match('xxx',string_a):在字符串a的开头匹配xxx,如果匹配成功则返回值为1。re.search('xxx',string_a):在字符串a中匹配一个xxx,如果匹配成功则返回值为1。re.findall('xxx',string_a):在字符串a中匹配所有xxx,如果匹配成功则返回列表。re.finditer('xxx',string_a):在字符串a中匹配所有xxx,如果匹配成功则以迭代器返回。原创 2020-10-24 11:29:04 · 222 阅读 · 0 评论 -
【学习记录】Python-JSON
【学习记录】Python-JSONJSON格式[{ "name" : "Tom", "phone" : { type : "hide", "number" : "+86 13333333333" } },{ "name" : "Jeck", "phone" : { type : "open", "number" : "+86 12222222222" }}]Python处理JSONimport jsondata =原创 2020-10-24 11:27:46 · 198 阅读 · 0 评论 -
【学习记录】Python-Encode&Decode
【学习记录】Python-Encode&DecodeASCII全称American Standard Code of Information InterchangeUnicode全称Universal Character SetGBK缩写来源于“国标扩展”(Guo Biao Kuozhan)ASCIIprint(ord('H')):打印字符H的ASCII序数(ordinal:序数的)UnicodePython2中,字符串默认以字节未编码的格式保存x = 'TEST'type(x原创 2020-10-24 11:25:22 · 207 阅读 · 1 评论 -
【学习记录】Python-Conda
【学习记录】Conda常用命令查看版本:conda info -v查看环境:conda env list删除环境:conda remove -n env_name --all创建环境:conda create -n env_name python=3.7 numpy pandas matplotlib列出所有安装包:conda list查看安装包版本:conda search numpy安装某个安装包:conda install numpy=1.19.2操作要点实时更新中...原创 2020-10-24 11:19:48 · 1467 阅读 · 0 评论