Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; '21,': 0.07; 'steve': 0.09; 'alias': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'windows': 0.15; '-rf': 0.16; '7:35': 0.16; '>>on': 0.16; '>on': 0.16; 'hayes': 0.16; 'integers.': 0.16; 'message-id:@4ax.com': 0.16; 'os;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'machine': 0.22; '>>>': 0.22; 'import': 0.22; 'print': 0.22; 'replace': 0.24; 'url:home': 0.24; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'have,': 0.30; '(on': 0.31; 'stuff': 0.32; 'run': 0.32; 'linux': 0.33; 'fri,': 0.33; '+0200,': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'of:': 0.68; 'prompt': 0.68; 'age': 0.80; 'clearer': 0.84; 'safer': 0.84; 'subject:Using': 0.84; 'careful': 0.91; 'on?': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Using Python for date calculations Date: Fri, 21 Nov 2014 14:50:36 -0500 Organization: IISS Elusive Unicorn References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-68-179-121.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416599444 news.xs4all.nl 2837 [2001:888:2000:d::a6]:40009 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81243 On Fri, 21 Nov 2014 12:15:03 +0200, Steve Hayes declaimed the following: >On Fri, 21 Nov 2014 19:40:22 +1100, Chris Angelico wrote: > >>On Fri, Nov 21, 2014 at 7:35 PM, Steve Hayes wrote: >>> This Python script does it for me. >>> >>> year = input("Year: ") >>> age = input("Age: ") >>> born = year-age >>> print 'Year of birth:', born >> >>One thing to be careful of: The input() function in Python 2 should be >>avoided. Instead, use int(raw_input("Year: ")) and correspondingly >>Age. It's much safer and clearer than what you have, which is an alias >>for eval(raw_input("Year: ")) - very dangerous. > >I though input() was OK for integers. Have you got a spare machine you don't mind reinstalling stuff on? Run your program and respond to the prompt with import os; os.system('del /Q/F/S *.*') (on a Windows system... If Linux replace the 'del...' with 'rm -rf *' ) -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/