首页 文章 精选 留言 我的

精选列表

搜索[python解释器],共10000篇文章
优秀的个人博客,低调大师

python paramiko CryptographyDeprecationWarning

import paramiko client = paramiko.SSHClient() client.connect(serverIp, port=serverPort, username=serverUser) 报警告如下: paramiko\ecdsakey.py:164: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point self.ecdsa_curve.curve_class(), pointinfo paramiko\kex_ecdh_nist.py:39: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding. m.add_string(self.Q_C.public_numbers().encode_point()) paramiko\kex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point self.curve, Q_S_bytes paramiko\kex_ecdh_nist.py:111: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding. hm.add_string(self.Q_C.public_numbers().encode_point()) 原因 paramiko 2.4.2 依赖 cryptography,而最新的cryptography==2.5里有一些弃用的API。 解决 删掉cryptography 2.5,安装2.4.2,就不会报错了。 pip uninstall cryptography==2.5 pip install cryptography==2.4.2 补充 paramiko的issue #1369提到了这个问题,并已有PR #1379了,尚未合并。

优秀的个人博客,低调大师

python 文件处理

模式: 读'r' 写[清空整个文件]'w' 追加[文件需要存在]'a' 读写'r+' 二进制文件'b' 'rb','wb','rb+' 写文件 i={'ddd':'ccc'} f = file('poem.txt', 'a') f.write("string") f.write(str(i)) f.flush() f.close() 读文件 f = file('/etc/passwd','r') c = f.read().strip() # 读取为一个大字符串,并去掉最后一个换行符 for i in c.spilt('\n'): # 用换行符切割字符串得到列表循环每行 print i f.close() 读文件2 > for i in open('b.txt'): # 直接读取也可迭代,并有利于大文件读取,但不可反复读取 print i, 追加日志 > log = open('/home/peterli/xuesong','a') print >> log,'faaa' log.close() with读文件 with open('a.txt') as f: for i in f: print i print f.read() # 打印所有内容为字符串 print f.readlines() 文件随机读写 # 文件本没有换行,一切都是字符,文件也没有插入功能 f.tell() # 当前读写位置 f.read(5) # 读取5个字符并改变指针 f.seek(5) # 改变用户态读写指针偏移位置,可做随机写 f.seek(p,0) # 移动当文件第p个字节处,绝对位置 f.seek(p,1) # 移动到相对于当前位置之后的p个字节 f.seek(p,2) # 移动到相对文件尾之后的p个字节 f.seek(0,2) # 指针指到尾部 # 改变指针超出文件尾部,会造成文件洞,ll看占用较大,但du -sh却非常小 f.read(65535) # 读取64K字节 f.write("str") # 写会覆盖当前指针后的响应字符,无插入功能

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册