摘要:
def test(name,country='China'): print(name) print(country)# a = "小黑"# b = "japan"# # test(b,a)# test(country="japan",name="xiaohei")# test("小黑",countr 阅读全文
posted @ 2021-05-14 10:55
零食生活时代
阅读(73)
评论(0)
推荐(0)
摘要:
#1替换方法f=open("users.txt",encoding="utf-8")#f=open(r"users.txt",encoding="utf-8") r:代表原字符,特殊符号不要转义result=f.read()f.close()new_result=result.replace("he 阅读全文
posted @ 2021-05-14 10:16
零食生活时代
阅读(425)
评论(0)
推荐(0)
摘要:
# r,w,a# r+,w+.a+ 读写,写读,追加读#rb wb ab#rb+ wb+ ad+#r相关,文件不存在会报错,他的文件指针是在最前面的#w相关,都会创建文件,清空文件内容#a相关,如果要读,就移动文件指针,不管怎么移动文件指针,写的时候都是追加在最后面#a+:想读想写,用a+加上移动文 阅读全文
posted @ 2021-05-14 10:11
零食生活时代
阅读(68)
评论(0)
推荐(0)
摘要:
#函数、方法#提高的代码复用性,简化代码def hello(): print('hello')def welcome(name,country="中国"): return name,countrydef test(): returnr = hello()print('没有写return',r)pri 阅读全文
posted @ 2021-05-14 09:57
零食生活时代
阅读(244)
评论(0)
推荐(0)
摘要:
import json #使用前提,导入json库#{"code":0,"msg":"操作成功","token":"xxxxx"}#json是一个字符串#json串和字典间的互相转换#字典转json串d={"code":0,"msg":"操作成功","token":"xxxxx"}json_str= 阅读全文
posted @ 2021-05-14 09:46
零食生活时代
阅读(69)
评论(0)
推荐(0)

浙公网安备 33010602011771号