> Is there any difference if I remove the '/'

You mean the '\' I assume?

In this case no difference whatsoever because Python 
will keep on looking for the matching closing ']'

> intMatrix2 = [[1,1,2,4,1,7,1,7,6,9],\
>             [1,2,5,3,9,1,1,1,9,1],\
>             [0,0,5,1,1,1,9,7,7,7]]

> So what is the use of '\'?

\ is the line continuation character. Thus if you need to wrap a line but 
don't want python to interpret it as two lines use a \ character:

>>> print ' here is a long line of text ' + \
... 'extended by another string'
' here is a long line of text extended by another string'

Without the \ char you get an error.

But if there is an open bracket or paren then Python ignores the 
end of line until it finds the closing paren etc.

However many programmers like to put the \ char anyway just to 
indicate that it is a single logical line broken for readability

HTH,

Alan G.




_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to