Path: csiph.com!usenet.pasdenom.info!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'example:': 0.03; 'newbie': 0.05; 'debugging': 0.07; 'lawrence': 0.09; 'subject:module': 0.09; 'suggestions:': 0.09; 'translate': 0.10; 'python': 0.11; 'dump': 0.16; 'dumps': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'import': 0.22; 'cc:addr:gmail.com': 0.22; 'file.': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'perl': 0.31; 'pickle': 0.31; 'another': 0.32; 'url:python': 0.33; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'format.': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'most': 0.60; 'received:unknown': 0.61; 'url:3': 0.61; 'email addr:gmail.com': 0.63; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'received:69.89': 0.84 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mad-scientist.net; s=default; h=Content-Transfer-Encoding:Mime-Version:Content-Type:References:In-Reply-To:Date:Cc:To:Reply-To:From:Subject:Message-ID; bh=kpRbMuMzX/89WWulcKL4fpABnEb94skzTSab5e95s30=; b=SH/mxeQc2WsWQkuvDQP4nOsaxzFIA49bYjFhd9/11Vw+kmhcypyQi7VMJgnLiPrQzupPme++4X8WDFKxDh1hZN3wTIKX7OcqUrHfkdk+H/6agB7dkUEysXLQnApL4Xey; Subject: Re: Logger module in python From: Paul Smith To: python-list@python.org Date: Tue, 17 Dec 2013 22:46:06 -0500 In-Reply-To: References: Organization: GNU's Not UNIX! Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Identified-User: {678:box531.bluehost.com:madscie1:mad-scientist.us} {sentby:smtp auth 146.115.71.23 authed with paul@mad-scientist.us} Cc: smilesonisamal@gmail.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: paul@mad-scientist.net 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387338793 news.xs4all.nl 2909 [2001:888:2000:d::a6]:42331 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62266 On Wed, 2013-12-18 at 03:27 +0000, Mark Lawrence wrote: > On 18/12/2013 03:22, smilesonisamal@gmail.com wrote: > > Hi, > > I am a newbie in python. I am looking for a existing module which I > can import in my program to log the objects to a file? > > > > I know there is a module Data::Dumper in perl which dumps the > objects to file. But not sure about python. > > http://docs.python.org/3/library/logging.html That's not what the OP wants. Pradeep, if you want to dump data for debugging take a look at the pprint module; for example: http://docs.python.org/3.3/library/pprint.html If you want to store Python objects in files and read them later, most people seem to use pickle for that: http://docs.python.org/3.3/library/pickle.html Others translate into another format. See this SO question for some other suggestions: http://stackoverflow.com/questions/2540567/is-there-a-python-equivalent-to-perls-datadumper