mirror of
https://github.com/onkelbeh/cheatsheets.git
synced 2026-08-16 05:54:53 +02:00
Update python.md
This commit is contained in:
@@ -121,8 +121,9 @@ category: Python
|
|||||||
```py
|
```py
|
||||||
file = open("hello.txt", "r") # open in read mode 'r'
|
file = open("hello.txt", "r") # open in read mode 'r'
|
||||||
file.close()
|
file.close()
|
||||||
|
```
|
||||||
|
|
||||||
---
|
```py
|
||||||
print(file.read()) # read the entire file and set the cursor at the end of file
|
print(file.read()) # read the entire file and set the cursor at the end of file
|
||||||
print file.readline() # Reading one line
|
print file.readline() # Reading one line
|
||||||
file.seek(0, 0) # place the cursor at the beggining of the file
|
file.seek(0, 0) # place the cursor at the beggining of the file
|
||||||
|
|||||||
Reference in New Issue
Block a user