08 2021 档案
摘要:1:可接受任意数量参数的函数 *args # 为了能让一个函数接受任意数量的位置参数,可以使用一个*参数 def avg(first, *args): return (first + sum(args)) / (1 + len(args)) print(avg(1, 2)) # 1.5 print(
阅读全文
摘要:1:读写文本数据 :读写各种不同编码的文本数据ASCII,UTF-8或UTF-16编码等 # rt模式下,python在读取文本时会自动把\r\n转换成\n,文本文件用二进制读取用‘rt’; # 使用带有 rt 模式的 open() 函数读取文本文件 with open('aaaa', "rt")
阅读全文
摘要:https://www.cnblogs.com/rslai/p/8135460.html
阅读全文