#coding:utf-8'''filename: convertletter.py'''defconvert(s):"""convert upper and lower in a string.convert(string) -> string"""lst=[e.upper()ife.islower()elsee.lower()foreins]return"".join(lst)if__name__=="__main__":word="Python"new_word=convert(word)print(f"{word}-->{new...
client.py import socket client = socket.socket() #创建client client.connect(('127.0.0.1',8999)) #连接server while 1: data = input('echo>>>') client.send(bytes(data,'utf-8')) #发送bytes 0赞 · 0采集 慕尼黑70501942024-09-01
今日概要: 第三方模块 -- word 面向对象 1 Word格式-第三方模块 自定义模块 内置模块 第三方模块 requests bs4 openpyxl python-docx 1.1 快速上手 pip install python-docx docx文件,本质上是压缩包 docx文件本质上是由
[35m2to3[m[m [35mlzfgrep[m[m [31m2to3-3.7[m[m [35mlzgrep[m[m [34mAssistant.app[m[m [35mlzless[m[m [34mDesigner.app[m[m [35mlzma[m[m [34mLinguist.app[m[m [31mlzmadec[m[m Pandas数据载入与预处理.ipynb [31mlzmainfo[m[m Python的input和output.ipynb [35mlzmore[m[m [31ma...
有点像序列化一个对象 使用pickle序列化numpy array 代码语言:javascript 复制 importpickleimportnumpyasnp 代码语言:javascript 复制 # 创建一维数组 x=np.arange(10)x 代码语言:javascript 复制 array([0,1,2,3,4,5,6,7,8,9]) 代码语言:javascript ...
os.path.abspath(file) import os base_dir = os.path.dirname(os.path.abspath(file)) • 判断路径是否存在 import os v1 = os.path.exists("路径") print(v1) # True/False import os user = input("用户名:") file_path = os.path.join("files", "db.txt") ...
if file.endswith('.py'): list.append(file) print(list) 1. 2. 3. 4. 5. 6. 7. 8. 9. 6,在树莓派后台检查树莓派上插的U盘的文件大小 du -s /media/usb0/mega.log --apparent-size 1. 7,查询window磁盘占用率: from subprocess import PIPE,Popen ...
(df: pd.DataFrame) -> None: """ input df must contain strike, expiry, and iv. It will return a dotted scatter 3d plot :param df: :return: """ from matplotlib import cm fig = plt.figure() ax = fig.add_subplot(1, 1, 1, projection='3d') plt.title(f'BTC vol surface on {...
url=pyqrcode.create(s)# 保存二维码 url.svg("baidu.svg",scale=8) 结果如下。 ⑤语言检测 当你需要处理包含不同语言数据,且数据非常大的时候,语言检测就派上用场了。 使用Python中的langdetect包,可以在几行代码内检测超过55种不同的语言。 代码语言:javascript ...
A.a=5B.a=input()C.a=5D.a=5.0 15.下面哪个不是Python合法的标识符() A.int_3B.print CcountD__name__ .. 16.在Python中,下面代码的运行结果是() x=365 g=x%10#%为求余的意思 s=x//10%10#//为整除的意思 b=x//100 sum=g*100+s*10+b#sum英文是求和的意思 ...