User Tools

Site Tools


python_searching_a_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
python_searching_a_file [2017/02/02 09:05] – created luke7858python_searching_a_file [2017/02/02 09:29] (current) – luke7858
Line 1: Line 1:
 <sxh bash> <sxh bash>
-from sys import argv +config_directory=[] 
- +with open("/etc/httpd/conf/httpd.conf", "r") as search_file: 
-search_file = open("/etc/httpd/conf/httpd.conf", "r") +    for line in search_file: 
-for line in search_file: +        if 'IncludeOptional' in line: 
-        if "IncludeOptional" in line: print line +                config_directory.append(line) 
-search_file.close()+                print config_directory[0]
 </sxh> </sxh>
python_searching_a_file.1486026315.txt.gz · Last modified: (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki