Python Forum

Full Version: Help with file handling
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Sep-27-2018, 05:50 PM)gonzo620 Wrote: [ -> ]ex: extracting only the line containing the city Nord
Give this a swirl:
with open("filename") as f:
    for line in f:
        if "Nord" in line:
            print(line)
Pages: 1 2