help to code...

MRAB python at mrabarnett.plus.com
Thu May 2 11:04:20 EDT 2013


On 02/05/2013 14:50, leonardo selmi wrote:
> dear python community,
>
> i wrote the following program:
>
> from datetime import datetime
> now = datetime.now()
> current_month = now.month
> current_day = now.day
> current_year = now.year
> current_hour = now.hour
> current_minute = now.minute
> current_second = now.second
> print str(current_month) + '/' + str(current_day) + '/' +
> str(current_year) +' '+
> print str(current_hour) + str(current_minute) + str(current_second)
>
> and i got this error:
> Traceback (most recent call last):
>    File "runner.py", line 125, in compilecode
>    File "python", line 9
>      print str(current_month) + '/' + str(current_day) + '/' + str(current_year) +' '+
>                                                                                       ^
> SyntaxError: invalid syntax
>
> how can i write the last two lines correctly?
>
Look at where the caret (the "^") is pointing; there's a trailing "+".




More information about the Python-list mailing list