File Handling in Python
|
path = "C:\\Users\\Miho\\dir" for root, dirs, files in os.walk(path): for file in files: print(file) |
os.path.join(root, file) : Combine root and file str.endswith(".pdf"): Return True if str ends with ".pdf"
|
for line in file: if ('string1' in line.lower()) |('string2' in line.lower()): print(line) |
|
lines = f.read() f.close(): |
|
lines = f.read() f.close(): |
os.path.join(root, file) : Combine root and file str.endswith(".pdf"): Return True if str ends with ".pdf"
|
with open('my_csv.csv') as csvfile lines = csv.reader(csvfile) for row in lines: |
Comments
Post a Comment