Well, I'm a begginer in Python coding, and at DaniWeb. My problem is: I can't open any files!

I tried:

>>> f = open('C:\teste.txt', 'w')

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    f = open('C:\teste.txt', 'w')
IOError: [Errno 22] invalid mode ('w') or filename: 'C:\teste.txt'
>>> f = 'C:\teste.txt'
>>> open(f)

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    open(f)
IOError: [Errno 22] invalid mode ('r') or filename: 'C:\teste.txt'
>>> open ('C:\teste.txt', 'r')

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    open('C:\teste.txt', 'r')
IOError: [Errno 22] invalid mode ('r') or filename: 'C:\teste.txt'

Tried in Python Shell & Cmm Line...
Using Python 2.6.4 for WinXp installed in C:\Python 26

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.