摘要: 写文件的前提也是先要获取到文件的对象 文件的打开方式一定要是可写的模式(w或者a) w会覆盖会自动创建 a是追加,而且不会自动创建文件 <文件对象>.write(新内容) 举例: file='C:\\Users\\GYF\\Desktop\\doc\\my_file.txt' My_file=ope 阅读全文
posted @ 2020-02-29 12:26 frozenheart 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 一,Python的文件类型有两种 1.文本文件 2.二进制文件 文件的操作: 1.打开文件,获取文件的控制权 2.读写文件 3.关闭文件,释放文件的控制权,如果不释放控制权,那么其他程序就不能访问此文件 二,Python文件打开方式 使用open函数 如: My_file=opne("C:\\pyt 阅读全文
posted @ 2020-02-27 22:29 frozenheart 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 代码如下: 1 import matplotlib.pyplot as plt 2 from random import choice 3 class RandomWalk(): 4 def __init__(self,num_points=5000): 5 self.num_points=num_ 阅读全文
posted @ 2020-02-25 23:57 frozenheart 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 之前的随笔里有写过关于Mac OS和Linux的,现在需要用到Windows的系统, 修改方法:路径 > C:\Users\用户名\AppData\Roaming,在Roaming文件夹下新建pip文件夹。 在pip文件夹下创建pip.ini配置文件,并在文件中写入以下内容(跟在Linux里面的内容 阅读全文
posted @ 2020-02-25 22:49 frozenheart 阅读(759) 评论(0) 推荐(0) 编辑
摘要: There are many pionts in this kind of table. How to do it? We can use scatter() to draw it. Code: import matplotlib.pyplot as plt plt.scatter(1,4) plt 阅读全文
posted @ 2020-02-21 19:12 frozenheart 阅读(143) 评论(0) 推荐(0) 编辑
摘要: $sudo apt-get install python3-matplotlib gyf@gyf-VirtualBox:~$ python3Python 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] on linuxType "help", "c 阅读全文
posted @ 2020-02-20 18:56 frozenheart 阅读(223) 评论(0) 推荐(0) 编辑
摘要: $sudo apt-get install nmap $nmap 127.0.0.1 Starting Nmap 7.60 ( https://nmap.org ) at 2020-02-20 15:32 CSTNmap scan report for localhost (127.0.0.1)Ho 阅读全文
posted @ 2020-02-20 15:54 frozenheart 阅读(242) 评论(0) 推荐(0) 编辑
摘要: gyf@gyf-VirtualBox:~$ git clone https://github.com/yyuu/pyenv.git ~/.pyenvCloning into '/home/gyf/.pyenv'...remote: Enumerating objects: 17608, done.r 阅读全文
posted @ 2020-02-20 13:46 frozenheart 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 实际上并非必须遵守PEP 8,但是它已经成为一个默认的、约定俗成的规则,可以使代码风格更统一,提高可读性。 由于最近一直在学习Ubuntu,因此此处仍然以Ubuntu为例,介绍一下规则检查工具,它能帮助开发者检查代码是否符合PEP 8标准。 1.首先执行 pip3 install pycodesty 阅读全文
posted @ 2020-02-20 11:53 frozenheart 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 在使用pip下载时很多时候下载速度特别慢,时不时就会发生timeout。 这是因为安装源与本机之间网络不畅导致,其实可以自己指定pip的下载来源,就像指定ubuntu更新源那样。 接下来谈谈步骤: 1.需要在~/.pip/目录下创建pip.conf文件,并在文件中写入要指定的安装源: pip.con 阅读全文
posted @ 2020-02-20 11:26 frozenheart 阅读(265) 评论(0) 推荐(0) 编辑