Hi, I am new to this forum and new to Python. I am starting with some very basic scripting to manipulate and manage files. Eventually I want to setup some automated tasks to reduce workload.
Can anyone help me with my commands. I've managed to crate a text file and write into it but I cannot open the file and return the data within it via print.
I'm not sure where I'm going wrong, any comments would be appreciated.
I'm running Python 3.6.2 via a shell on a Windows operating system.
Thanks
Can anyone help me with my commands. I've managed to crate a text file and write into it but I cannot open the file and return the data within it via print.
I'm not sure where I'm going wrong, any comments would be appreciated.
I'm running Python 3.6.2 via a shell on a Windows operating system.
Thanks
>>> data = open("readit.txt", "r") >>> print data.read(1) SyntaxError: invalid syntax >>> data.close() >>> file = open("writefile.txt", "w") >>> file.write("hello") 5 >>> file.close() >>> read = open("writefile.txt", "r") >>> print read.line(1) SyntaxError: invalid syntax >>> print read.readline SyntaxError: Missing parentheses in call to 'print' >>> print read.line(0) SyntaxError: invalid syntax >>> print read.read() SyntaxError: invalid syntax >>>