Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'error:': 0.07; 'subject:help': 0.08; 'trailing': 0.09; 'python': 0.11; 'wrote': 0.14; '"python",': 0.16; "'/'": 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'community,': 0.19; '(the': 0.22; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'lines': 0.31; 'file': 0.32; '(most': 0.33; 'received:84': 0.35; 'two': 0.37; 'to:addr:python- list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'dear': 0.65; 'header:Reply-To:1': 0.67; 'invalid': 0.68; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:python.org': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=JsTI8qIC c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=7AxPfEIvyrUA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=kXPjS0m1utAA:10 a=LNndwztXAzQyBmLxE_EA:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Thu, 02 May 2013 16:04:20 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: help to code... References: <1F2E5209-2F0F-4DE2-88BC-DB9C2267B0F3@icloud.com> In-Reply-To: <1F2E5209-2F0F-4DE2-88BC-DB9C2267B0F3@icloud.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367507056 news.xs4all.nl 15985 [2001:888:2000:d::a6]:47625 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44636 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 "+".