1樓:匿名使用者
try:
如果有讀取檔案
except filenotfounderror:
如果沒有可讀取檔案
求助大佬,這個python作業的**要怎麼寫?
2樓:格藍英奇
效果圖我看題目沒有回說要型別轉
答換的就沒有轉換,有問題繼續追問
求助大佬,這個python作業的**要怎麼寫?
3樓:匿名使用者
f = open("test.txt", 'wb') # 二進位制寫模式
f.write(b'precious things are very few!') # 二進位制寫
f.write(b'i wish you success in your work!') # 二進位制寫
f.write(b'with the ***pliments of the season!') # 二進位制寫
f.write(b'may joy and health be with you always!') # 二進位制寫
f.write(b'a friend is a loving ***panion at all times!') # 二進位制寫
f.close() # 關閉檔案
f = open("test.txt", 'rb') # 二進位制讀
print(f.read()) # 列印讀出來的資料
f.close() # 關閉檔案
4樓:匿名使用者
ss = '''precious things are very few!
i wish you success in your work!
with the ***pliments of the season!
may joy and health be with you always!
a friend is a loving ***panion at all times!'''
with open('./exp030202.txt','wb',encoding='utf-8') as file1:
file1.write(ss)
with open('./exp030202.txt','rb',encoding='utf-8') as file2:
print(file2.read())
5樓:我配合的演出
in [4]: with open(r'e:/exp030202.txt','wb') as t:
...: t.write(ss.encode())...:
...:
in [5]: with open(r'e:/exp030202.txt','rb') as t:
...: print(t.read())...:
6樓:格藍英奇
s = """precious things are very few!
i wish you success in your work!
with the ***pliments of the season!
may joy and health be with you always!
a friend is a loving ***panion at all times!"""
with open('exp030202.txt', 'wb')as f:
f.write(s.encode('utf-8','strict'))
f.close()
with open('exp030202.txt', 'rb')as f:
read_data = f.read()
print(read_data)
f.close()效果圖
大佬幫我看一下這道python題我**錯了
7樓:紫薇參星
你的python程式有三處錯誤,一 求b和c的值應該放在for-z迴圈外,二 題目要求求1000次測試中有多少次生日重複的比率,不是每次有多少生日不重複的比率,三 每次測試list都要清零
完整的python程式如下
源**(注意源**的縮排)
請問大佬這道vb題空答案是多少,請問大佬這道vb題三個空答案是多少?
private sub form click dim i n t 源,e e 0 n 1 i 0 t 1 do while t 0.00001 e e t i i 1 n n i t 1 n loop print 計算了 bai i 項的 du和zhi 是dao e end sub 請問vb大佬,這...
請問大家這道題目怎麼做了謝謝,這道數學題目怎麼做
3.因為剩下路程是已行駛路程的4.1倍,所以剩下路程 76.5 4.1 313.65 千米 所以鐵路線全長為 313.65 76.5 390.15 千米 76.5 4.1 76.5 390.15m 76.5 1 4.1 76.5 5.1 390.15 千米 這道數學題目怎麼做?你好,解析如下 解 設...
大佬們求教這道工程力學的題目咋寫啊
a dufx 0 no g 0 1 mo 0 m 2g 0 2 解得 zhino g m 2g b fx 0 na.sin45度 nox 0 1 fy 0 na.cos45度 noy g 0 2 ma 0 2noy 4g 0 3 上三式聯立解dao得 na g 2 aox g aoy 2g 更多的是...