摘要:
1. 文件a.txt内容:每一行内容分别为商品名字,价钱,个数,求出本次购物花费的总钱数apple 10 3tesla 100000 1mac 3000 2lenovo 30000 3chicken 10 3 sum = 0f = open("shoping.txt","r",encoding="u 阅读全文
posted @ 2018-11-19 16:28
陈Chenchen
阅读(1842)
评论(0)
推荐(0)
摘要:
在python中 #1. 打开文件,得到文件句柄并赋值给一个变量f=open('a.txt','r',encoding='utf-8') #默认打开模式就为r #2. 通过句柄对文件进行操作data=f.read() #3. 关闭文件f.close() f=open('a.txt','r')的过程分 阅读全文
posted @ 2018-11-19 16:27
陈Chenchen
阅读(125)
评论(0)
推荐(0)

浙公网安备 33010602011771号