3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Dan08
0

Yes, yes you can!

If you want to open a .txt file named: "log.txt" which is in the same directory as where you are working from:

log=open("log.txt",'r')
"""
Here, you can replace 'log' with any name you want. And 'r' specifies that you want to read from the file, whereas 'w' specifies that you want to write to a document.
"""
log_read=log.read()
# read() method returns a string variable
log_readlines=log.readlines()
# readlines() returns a variable of list data type
0

If you want to open notepad.
You can use the os module.

import os
os.system('start notepad.exe')

Thats exactly what i wanted to do, thanks snippsat.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.