f = open("ascii.txt", "r", encoding='utf8')
print(f.read())
f.close()
x = "黃珍甄"
f = open("ascii.txt", "r+",encoding='utf8')
y = f.write(x)
print(y)
f.close()
f = open("ascii.txt", "r", encoding='utf8')
print(f.read())
f.close()
x = "黃珍甄"
f = open("ascii.txt", "r+",encoding='utf8')
y = f.write(x)
print(y)
print("檔案名稱",f.name)
print("檔案模式",f.mode)
print("是否關閉",f.closed)
f.write("黃珍甄")
line = f.read() #讀取檔案f成為字串
print("檔案字串長度",len(line))
print("檔案內容",line)
f.close()
影片373 程式碼 print(int(10)) print(int("ff",16)) print(int('100',16)) print(int('100',8)) print(0>1,2>1,3==3) a = []#串列list使用square bracket中括號 print("是否all全真",all(a)) print("存在任何any一個真",any(a)) print("黃珍甄bin二進位輸出一到9") for i in range(10): #0 to 9進位1 print(bin(i)) for i in range(0,200,10): print(hex(i)) a = ('蘋果', '香蕉', '櫻桃',"durian") b = "Hello World" c = 33 d ={'蘋果', '香蕉', '櫻桃',"durian"} e=['蘋果', '香蕉', '櫻桃',"durian"] print("a元組typle", type(a)) print("b字串", type(b)) print("c整數integer", type(c)) print(type(d), type(e)) w3schools內建函數列表 Function Description abs() Returns the absolute value of a number all() Returns True if all items in an iterable object are true any() Returns True if any item in an iterable object is true ascii() Returns a readable version of an object. R...
留言
張貼留言