Indentation example?
ICT Ezy
ictezy at gmail.com
Sun Jun 12 12:23:32 EDT 2016
On Sunday, June 12, 2016 at 9:36:16 PM UTC+5:30, Steven D'Aprano wrote:
> On Mon, 13 Jun 2016 01:10 am, ICT Ezy wrote:
>
> > Pl explain with an example the following phase
> > "Indentation cannot be split over multiple physical lines using
> > backslashes; the whitespace up to the first backslash determines the
> > indentation" (in 2.1.8. Indentation of Tutorial.) I want to teach my
> > student that point using some examples. Pl help me any body?
>
>
> Good indentation:
>
> def function():
> # four spaces per indent
> print("hello")
> print("goodbye")
>
>
> Bad indentation:
>
> def function():
> # four spaces per indent
> print("hello") # four spaces
> \
> print("goodbye") # two spaces, then backslash, then two more
>
>
> The second example will be a SyntaxError.
>
>
>
> --
> Steven
Thank you very much your example
More information about the Python-list
mailing list