Skip to content

Commit a45fe3c

Browse files
authored
Update README.md
1 parent 008be06 commit a45fe3c

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -13,74 +13,74 @@ pip install PyPDF2 python-docx pandas beautifulsoup4
1313

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

16-
Creating and writing to a file:
16+
## Creating and writing to a file:
1717

1818
```python
1919

2020
with open("filename.txt", "w") as f:
2121
f.write("Hello, World!")
2222
```
23-
Reading from a file:
23+
### Reading from a file:
2424

2525
```python
2626

2727
with open("filename.txt", "r") as f:
2828
print(f.read())
2929
```
30-
Appending to an existing file:
30+
### Appending to an existing file:
3131

3232
```python
3333

3434
with open("filename.txt", "a") as f:
3535
f.write("More text.")
3636
```
37-
Deleting a file:
37+
### Deleting a file:
3838

3939
```python
4040

4141
import os
4242
os.remove("filename.txt")
4343
```
44-
Checking if a file exists:
44+
### Checking if a file exists:
4545

4646
```python
4747

4848
import os
4949
os.path.exists("filename.txt")
5050
```
51-
Creating a directory:
51+
### Creating a directory:
5252

5353
```python
5454
import os
5555
os.mkdir("directory_name")
5656
```
57-
Large File Handling
57+
## Large File Handling
5858

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

61-
Opening a file:
61+
### Opening a file:
6262

6363
```python
6464

6565
file = open('large_file.txt', 'r')
6666
```
67-
Reading a file line by line:
67+
### Reading a file line by line:
6868

6969
```python
7070

7171
with open('large_file.txt', 'r') as file:
7272
for line in file:
7373
print(line)
7474
```
75-
Reading a specific number of lines:
75+
### Reading a specific number of lines:
7676

7777
```python
7878

7979
from itertools import islice
8080
with open('large_file.txt', 'r') as file:
8181
head = list(islice(file, 5))
8282
```
83-
Searching within a large file:
83+
### Searching within a large file:
8484

8585
```python
8686

@@ -89,14 +89,14 @@ with open('large_file.txt', 'r') as file:
8989
if 'some_text' in line:
9090
print(line)
9191
```
92-
Writing to a large file:
92+
### Writing to a large file:
9393

9494
```python
9595

9696
with open('large_file.txt', 'w') as file:
9797
file.write('some_text')
9898
```
99-
Splitting files:
99+
### Splitting files:
100100

101101
```python
102102

@@ -108,11 +108,11 @@ with open('large_file.txt', 'r') as file:
108108
chunk_file.write(chunk)
109109
chunk = file.read(chunk_size)
110110
```
111-
Handling Specific File Formats
111+
## Handling Specific File Formats
112112

113113
Python can read various file formats using specific libraries. Here are some examples:
114114

115-
Reading PDF files:
115+
### Reading PDF files:
116116

117117
```python
118118

@@ -123,7 +123,7 @@ with open('example.pdf', 'rb') as file:
123123
page = reader.getPage(0)
124124
print(page.extract_text())
125125
```
126-
Reading Word documents:
126+
### Reading Word documents:
127127

128128
```python
129129

@@ -133,7 +133,7 @@ doc = Document('example.docx')
133133
for para in doc.paragraphs:
134134
print(para.text)
135135
```
136-
Reading Excel files:
136+
### Reading Excel files:
137137

138138
```python
139139

@@ -142,7 +142,7 @@ import pandas as pd
142142
data = pd.read_excel('example.xlsx')
143143
print(data)
144144
```
145-
Reading HTML files:
145+
### Reading HTML files:
146146

147147
```python
148148

@@ -152,6 +152,6 @@ with open("example.html") as fp:
152152
soup = BeautifulSoup(fp, 'html.parser')
153153
print(soup.prettify())
154154
```
155-
Credits
155+
## Credits
156156

157157
This README was generated with the help of ChatGPT, an AI developed by OpenAI.

0 commit comments

Comments
 (0)