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


Groups > comp.lang.python > #52601

Re: How to I do this in Python ?

Path csiph.com!usenet.pasdenom.info!aioe.org!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 <random832@fastmail.us>
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; '16,': 0.03; 'subject:Python': 0.06; 'received:internal': 0.09; 'subject:How': 0.10; 'python': 0.11; '(before': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'recipe': 0.16; 'roy': 0.16; 'truncate': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'written': 0.21; 'aug': 0.22; 'shell': 0.22; 'specify': 0.24; 'file.': 0.24; 'header:In-Reply- To:1': 0.27; 'this.': 0.32; 'url:python': 0.33; 'ago': 0.33; 'entirely': 0.33; 'fri,': 0.33; 'received:66': 0.35; 'tool': 0.35; 'there': 0.35; 'doing': 0.36; 'url:org': 0.36; 'received:10': 0.37; 'easiest': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'prompt': 0.68; 'smith': 0.68; 'subject:this': 0.83; '2013,': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= HNrqoA0CVPjmYXoSA4g8y+mCBWI=; b=IzAuusYA3UuQm8NtoXSngqgijwaLeEm8 la9QDyW+fMypuGM7LDZCrqCa2Orz306sMhWV2yNnnxcrpMqUkyJWLdiAS83GOKH7 OUyFG1h61nwZE3IZ27NauJjso0H/HJAQrjsKPwzSGgJcQcOWi5stxwbjuNL11vcE IeP+jjyRQ0o=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=HNrqoA0CVPjmYXoSA4g8y+mCBWI=; b=scr oFpVO7bEoDJ6W2oocq2JXK/+2J/PSd334iJVHorGfh68oUfAz8TL66dbW7d9TOLj tLDtL2NC4m6bYOH6SWXI+HAlFKf5GhLegT8+kNeWqGDUY7yH+mngY7qVJS49hAAw re5Ek/xzMkCwqkieFGHllqD5rrKc1HuGCP+11Y+s=
X-Sasl-Enc DKjWJw+cVZkDKMpO5YfajJQlWTb2XO4CTnsvdNnbN1/5 1376677024
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-3ac28d5b
In-Reply-To <roy-C7472E.07470816082013@news.panix.com>
References <mailman.614.1376636762.1251.python-list@python.org> <roy-C7472E.07470816082013@news.panix.com>
Subject Re: How to I do this in Python ?
Date Fri, 16 Aug 2013 14:17:04 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4.1376677027.23369.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376677027 news.xs4all.nl 15921 [2001:888:2000:d::a6]:36785
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52601

Show key headers only | View raw


On Fri, Aug 16, 2013, at 7:47, Roy Smith wrote:
> There is no need to shell out to dd just to do this.  All dd is doing 
> for you is seeking to the offset you specify and closing the file.  You 
> can do that entirely in Python code.
> 
> http://docs.python.org/2.7/library/stdtypes.html#file.seek

*ahem*

http://docs.python.org/2.7/library/stdtypes.html#file.truncate

The dd recipe was written some time over a decade ago as the easiest way
to achieve this at a shell prompt (before the truncate tool was added to
coreutils), and no-one's ever thought twice about it.

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


Thread

How to I do this in Python ? Ganesh Pal <ganesh1pal@gmail.com> - 2013-08-16 11:51 +0530
  Re: How to I do this in Python ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 10:59 +0000
    Re: How to I do this in Python ? Ganesh Pal <ganesh1pal@gmail.com> - 2013-08-18 22:36 +0530
      Re: How to I do this in Python ? Steven D'Aprano <steve@pearwood.info> - 2013-08-19 07:27 +0000
        Re: How to I do this in Python ? Ganesh Pal <ganesh1pal@gmail.com> - 2013-08-28 10:10 +0530
  Re: How to I do this in Python ? Roy Smith <roy@panix.com> - 2013-08-16 07:47 -0400
    Re: How to I do this in Python ? random832@fastmail.us - 2013-08-16 14:17 -0400

csiph-web