pythonpython-3.xcinema-4d

Python for C4D invalid syntax underneath file path?


Hi does anyone know why I have an error here underneath the t ?:

SyntaxError: invalid syntax File "'scriptmanager'", line 3 filepath = r '/Users/luke/Documents/water.numbers.csv' ^
SyntaxError: invalid syntax

regards,

import c4d

filepath = r '/Users/luke/documents/water.numbers.csv'

fileobj = (filepath, 'r')

print fileobj.readline ()


Solution

  • Is what you want this?

    1 import c4d
    2 
    3 filepath = r'/Users/luke/documents/water.numbers.csv'
    4             ^
    5 fileobj = open(filepath, 'r')
    6           ^^^^
    7 print fileobj.readline()
                            ^