. 1 # ! / Usr / bin / Python the env
2 # __author: HLC
. 3 # DATE: 2019/5/29
. 4
. 5 # can call methods must be the object
. 6
. 7 # Import Time
. 8 # the time.sleep (50) # 50 Wait sec
9
10 # last night Han Ming cricket live.
11 # shocked thousands of miles back to the dream, we have three shifts.
12 # up alone around the order line.
13 # of people quietly, Lianwai next month hazy.
14 # White song for fame.
15 # old mountain Shochiku old, blocking the way out.
16 # wishing mind Fuyao Qin.
17 # Appreciative strings off who listen?
18
19 #Read Mode
20 is # Data = Open ( "small mountains", "R & lt", encoding = "UTF-. 8"). Read ()
21 is
22 is # F = Open ( "small mountains", "r", encoding = "utf- 8 ") is opened in read mode #
23 is # Data reached, f.read = (. 5) # read operation, the read character 5
24 # Print (Data) # cold night without cricket
25 # f.close () # close, do not write off python by default will automatically shut down, but not always reliable
26
27 # to write mode
28 # f = open ( "small mountains", "w", encoding = "utf-8") # to write mode is turned on, the contents before emptying
29 # f.write ( "the Hello world") to write new content #
30 # f.close () # Close to close the file will be written to disk
31
32 # f = Open ( "small mountains""W", encoding = "utf-8") # to write mode is turned on, before emptying the contents, if the file does not exist, a new file is created
33 # f.close() # 关闭
34
35 # f = open("小重山2","w",encoding="utf-8")
36 # f.write("123 567")
37 # f.write("asd") # 123 567asd
38 # f.close()
39
40 # f = open("小重山2","w",encoding="utf-8")
41 # f.write("123 567\n")
42 # f.write("asd")
43 # f.close The ()
#49add#4847asd#46123 567#45#
44
f = open ( "small mountains 2", "A", encoding = "UTF-. 8")
50 # f.write ( "123 567 \ n-")
51 is # f.write ( "ASD")
52 is # f.close ()
53
54 # last night Han Ming cricket live.
55 # shocked thousands of miles back to the dream, we have three shifts.
56 # up alone around the order line.
57 # of people quietly, Lianwai next month hazy.
58 # White song for fame.
59 # old mountain Shochiku old, blocking the way out.
60 # wishing mind Fuyao Qin.
61 # Appreciative strings off who listen? 567 123
62 is # ASD