I have a large .txt file that I need to scan through to extrapolate certain lines of text from. I want to extract all lines that contain X amount of characters, and a certain phrase. How can I go about doing this?
|
Python
Script that extras lines from .txt file based on character count and phrases |
|
Jun 8, 2019 01:36 PM
(This post was last modified: Jun 8, 2019 01:37 PM by michalmonday.)
Code with open('data.txt') as f:(Jun 8, 2019 01:36 PM)michalmonday Wrote: It would probably be better to use some sort of regular expression for this. ¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸ `'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´ (Jun 9, 2019 02:12 PM)vorticalbox Wrote: It would probably be better to use some sort of regular expression for this. dont think so as he want the lines not the regex the example posted is the simple way to do it Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
|
|
|

