Skip to content

Commit 63851a1

Browse files
authored
Update README.md
1 parent e44025c commit 63851a1

File tree

1 file changed

+50
-19
lines changed

1 file changed

+50
-19
lines changed

README.md

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,84 @@
22

33
This project serves as a comprehensive guide to executing shell commands and handling files using Python.
44
Installation. You can install Python through the official website: https://www.python.org/downloads/
5-
## Usage
6-
This project can be used as a reference guide for executing shell commands and file handling in Python.
7-
Shell Commands with Python
5+
6+
## Table of Contents
7+
8+
- [Installation](#installation-requiments)
9+
- [Usage](#usage)
10+
- [Install Requirements](#install-requirements)
11+
- [Shell Commands with Python](#shell-commands-with-python)
12+
- [Creating and writing to a file](#creating-and-writing-to-a-file)
13+
- [Reading from a file](#reading-from-a-file)
14+
- [Appending to an existing file](#appending-to-an-existing-file)
15+
- [Deleting a file](#deleting-a-file)
16+
- [Checking if a file exists](#checking-if-a-file-exists)
17+
- [Creating a directory](#creating-a-directory)
18+
- [Large File Handling](#large-file-handling)
19+
- [Opening a file](#opening-a-file)
20+
- [Reading a file line by line](#reading-a-file-line-by-line)
21+
- [Reading a specific number of lines](#reading-a-specific-number-of-lines)
22+
- [Searching within a large file](#searching-within-a-large-file)
23+
- [Writing to a large file](#writing-to-a-large-file)
24+
- [Splitting files](#splitting-files)
25+
- [Handling Specific File Formats](#handling-specific-file-formats)
26+
- [Reading PDF files](#reading-pdf-files)
27+
- [Reading Word documents](#reading-word-documents)
28+
- [Reading Excel files](#reading-excel-files)
29+
- [Reading HTML files](#reading-html-files)
30+
- [Credits](#credits)
31+
- [Useful Resources](#useful-resources)
32+
33+
34+
35+
836

937
## Install requiments
1038
```python
1139
pip install PyPDF2 python-docx pandas beautifulsoup4
1240
```
41+
## Usage
42+
This project can be used as a reference guide for executing shell commands and file handling in Python.
43+
Shell Commands with Python
1344

1445
This project makes use of Python to execute shell commands. Here are some of the Python commands used in this project:
1546

16-
## Creating and writing to a file:
47+
## Creating and writing to a file
1748

1849
```python
1950

2051
with open("filename.txt", "w") as f:
2152
f.write("Hello, World!")
2253
```
23-
### Reading from a file:
54+
### Reading from a file
2455

2556
```python
2657

2758
with open("filename.txt", "r") as f:
2859
print(f.read())
2960
```
30-
### Appending to an existing file:
61+
### Appending to an existing file
3162

3263
```python
3364

3465
with open("filename.txt", "a") as f:
3566
f.write("More text.")
3667
```
37-
### Deleting a file:
68+
### Deleting a file
3869

3970
```python
4071

4172
import os
4273
os.remove("filename.txt")
4374
```
44-
### Checking if a file exists:
75+
### Checking if a file exists
4576

4677
```python
4778

4879
import os
4980
os.path.exists("filename.txt")
5081
```
51-
### Creating a directory:
82+
### Creating a directory
5283

5384
```python
5485
import os
@@ -58,29 +89,29 @@ os.mkdir("directory_name")
5889

5990
Working with large files requires a different set of Python commands. Here are some examples:
6091

61-
### Opening a file:
92+
### Opening a file
6293

6394
```python
6495

6596
file = open('large_file.txt', 'r')
6697
```
67-
### Reading a file line by line:
98+
### Reading a file line by line
6899

69100
```python
70101

71102
with open('large_file.txt', 'r') as file:
72103
for line in file:
73104
print(line)
74105
```
75-
### Reading a specific number of lines:
106+
### Reading a specific number of lines
76107

77108
```python
78109

79110
from itertools import islice
80111
with open('large_file.txt', 'r') as file:
81112
head = list(islice(file, 5))
82113
```
83-
### Searching within a large file:
114+
### Searching within a large file
84115

85116
```python
86117

@@ -89,14 +120,14 @@ with open('large_file.txt', 'r') as file:
89120
if 'some_text' in line:
90121
print(line)
91122
```
92-
### Writing to a large file:
123+
### Writing to a large file
93124

94125
```python
95126

96127
with open('large_file.txt', 'w') as file:
97128
file.write('some_text')
98129
```
99-
### Splitting files:
130+
### Splitting files
100131

101132
```python
102133

@@ -112,7 +143,7 @@ with open('large_file.txt', 'r') as file:
112143

113144
Python can read various file formats using specific libraries. Here are some examples:
114145

115-
### Reading PDF files:
146+
### Reading PDF files
116147

117148
```python
118149

@@ -123,7 +154,7 @@ with open('example.pdf', 'rb') as file:
123154
page = reader.getPage(0)
124155
print(page.extract_text())
125156
```
126-
### Reading Word documents:
157+
### Reading Word documents
127158

128159
```python
129160

@@ -133,7 +164,7 @@ doc = Document('example.docx')
133164
for para in doc.paragraphs:
134165
print(para.text)
135166
```
136-
### Reading Excel files:
167+
### Reading Excel files
137168

138169
```python
139170

@@ -142,7 +173,7 @@ import pandas as pd
142173
data = pd.read_excel('example.xlsx')
143174
print(data)
144175
```
145-
### Reading HTML files:
176+
### Reading HTML files
146177

147178
```python
148179

0 commit comments

Comments
 (0)