Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44636

Re: help to code...

Date 2013-05-02 16:04 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: help to code...
References <1F2E5209-2F0F-4DE2-88BC-DB9C2267B0F3@icloud.com>
Newsgroups comp.lang.python
Message-ID <mailman.1248.1367507056.3114.python-list@python.org> (permalink)

Show all headers | View raw


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 "+".

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: help to code... MRAB <python@mrabarnett.plus.com> - 2013-05-02 16:04 +0100

csiph-web