To delete blank lines without using sed, you can use the following method in Python. Here is a simple example:
```python
with open('file', 'r') as f:
lines =
with open('file', 'w') as f:
f.write('\n'.join(lines))
```
This code reads the file, strips whitespace from each line, and only keeps lines that are not empty after stripping, thus removing both empty lines and lines consisting of only spaces. You can adjust the file name as needed.
```python
with open('file', 'r') as f:
lines =
with open('file', 'w') as f:
f.write('\n'.join(lines))
```
This code reads the file, strips whitespace from each line, and only keeps lines that are not empty after stripping, thus removing both empty lines and lines consisting of only spaces. You can adjust the file name as needed.
