Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Joel Goldstick Newsgroups: comp.lang.python Subject: Re: issue with CVS module Date: Fri, 11 Mar 2016 15:05:30 -0500 Lines: 47 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de oeNqmh4MCVDXzuhSWn2NKgthYrjnO55whkxIeFAjRPYA== 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; 'value,': 0.03; 'cc:addr :python-list': 0.09; 'csv': 0.09; 'cvs': 0.09; 'open(file,': 0.09; 'subject:module': 0.09; 'python': 0.10; '(double': 0.16; '2016': 0.16; 'directive': 0.16; 'email addr:hotmail.com>': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'row': 0.16; 'subject:issue': 0.16; 'text?': 0.16; 'wrote:': 0.16; 'string': 0.17; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'received:209.85.214.174': 0.22; 'file:': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'went': 0.28; 'perl': 0.29; 'url:mailman': 0.30; 'noticed': 0.32; 'url:python': 0.33; 'quotes': 0.33; 'url:listinfo': 0.34; 'correctly': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:209': 0.38; 'received:209.85.214': 0.39; 'url:mail': 0.40; 'subject:with': 0.40; 'some': 0.40; 'back': 0.62; 'leaving': 0.63; 'mar': 0.65; 'url:info': 0.71; 'to:none': 0.91; 'joel': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=8kNRQtneUOhrRpMzHpgz01wbxpfXLbJLoIJw9qiYYt4=; b=OLcVWpKUxFAgwuDeIozBnUFdwxEycgK8qPqfBTQ49rOaCYxQL0xcUgqkM9eCeY01WF z7bSkBawP1e9NTnkRfBhU/d9XbgqziUt33RgYVTggR/bob1nm3Q6hy0C3r4DqMRphw7w 6tzgC+qVAUBopgQzSqNLAMdiKEjifSLEXD2nBLQNhAkFVsHsvymzEJF5DdP2OJ8AlwiQ 6eCedaVW8jXAbTVvfKSpw4/HU/zYORb1EazkTTVMZhVr7MqEBPkWFrYDxvdzMfi87OXD 0IfmeD3HegJ9jukD7q2L4FVGYFqPfdZlSPhwncxy4wzxvojTMWEZgv8bera0iQZ6hvvP m8NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=8kNRQtneUOhrRpMzHpgz01wbxpfXLbJLoIJw9qiYYt4=; b=EvoOs7QP4oYWun4cER8ZUReVcwe3VEghnG4G52ypLqEd2Uv+/vcbsbPla8jUZm26PW EIjuQtlpN4eXlPHaTmDTO+MhOLCV2tHt9hmQkBm3DOrYowm6pBHJhtPML49VxVNlR02m ggfNC8FB4PvSTF1M9nRk6FGYpZd56DBm7z/0i+wo/tplRaDW9gEHHnVgGbmpOO+cJ//i wxtQejBUMlmUJ9IetHrFF1O/i58L6Jh1jpzH8uWUqhWK+QaLDp/99zysOlAvmT46cPrF KN2bL5sRtGFU7sbapd5EE8/xJk49Ry/V2R2O/MyqhtAl2e94ANiE1K+yX+ZMlEMa4tag xqdw== X-Gm-Message-State: AD7BkJJncr9jdUjV0dvN+cOzkBcFCRaiKcbNE54iNTeUFI3arUg5Km0ifmEEnaqMURSp+scvT6c5q/XJQE4hCQ== X-Received: by 10.182.107.137 with SMTP id hc9mr6626498obb.74.1457726730639; Fri, 11 Mar 2016 12:05:30 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104634 On Fri, Mar 11, 2016 at 2:41 PM, Fillmore wrote: > > I have a TSV file containing a few strings like this (double quotes are > part of the string): > > '"pragma: CacheHandler=08616B7E907744E026C9F044250EA55844CCFD52"' > > After Python and the CVS module has read the file and re-printed the > value, the string has become: > > 'pragma: CacheHandler=08616B7E907744E026C9F044250EA55844CCFD52' > > which is NOT good for me. I went back to Perl and noticed that Perl was > correctly leaving the original string intact. > > This is what I am using to read the file: > > > with open(file, newline='') as csvfile: > > myReader = csv.reader(csvfile, delimiter='\t') > for row in myReader: > > and this is what I use to write the cell value > > sys.stdout.write(row[0]) > > Is there some directive I can give CVS reader to tell it to stop screwing > with my text? > > Thanks > -- > https://mail.python.org/mailman/listinfo/python-list > Enter the python shell. Import csv then type help(csv) It is highly configurable -- Joel Goldstick http://joelgoldstick.com/ http://cc-baseballstats.info/