Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40155
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'modify': 0.05; 'none:': 0.05; 'json': 0.07; 'skip:o 50': 0.07; 'python': 0.09; 'cc:addr:python-list': 0.10; 'advance': 0.10; 'files.': 0.13; ':-)': 0.13; 'csv': 0.16; 'discusses': 0.16; 'exclusion': 0.16; 'linux)': 0.16; 'row': 0.16; 'skip:[ 50': 0.16; 'subject: \n ': 0.16; 'subject:those': 0.16; 'subject:values': 0.16; 'url:json': 0.16; 'urllib': 0.16; 'value"': 0.16; 'wrote:': 0.17; 'certainly': 0.17; 'headers': 0.17; 'thu,': 0.17; 'feb': 0.19; 'import': 0.21; 'parse': 0.22; 'skip:c 70': 0.22; 'cc:2**0': 0.23; 'this:': 0.23; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'values': 0.26; 'message- id:@mail.gmail.com': 0.27; 'exclude': 0.29; 'url:mailman': 0.29; 'skip:& 10': 0.29; "i'm": 0.29; 'that.': 0.30; 'web.': 0.30; 'writes': 0.30; 'helpful': 0.30; 'problem.': 0.32; 'url:python': 0.32; 'file': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'skip:j 20': 0.33; 'hi,': 0.33; 'skip:& 20': 0.33; 'skip:d 20': 0.34; 'skip:- 50': 0.34; 'received:google.com': 0.34; 'text': 0.34; 'thanks': 0.34; 'list': 0.35; 'problem,': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'skip:u 20': 0.36; 'but': 0.36; 'url:org': 0.36; 'possible': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'called': 0.39; 'where': 0.40; 'url:mail': 0.40; 'url:t': 0.65; 'results': 0.65; 'stuck': 0.65; 'skip:c 50': 0.66; '2013': 0.84; 'secondlife': 0.84; 'subject:Import': 0.84; 'subject:content': 0.84; 'to:addr:libero.it': 0.84; 'joel': 0.91; 'sheet': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=KRQi1NWVtTcemyNETRV+HObJhA5i7LCxRkcPnAqtbio=; b=GVxPEd3iPqQVtEAXNheKmdjcvcVesNv5JwhrLpJgzC7xya0Xf37Demc5/4szmBNKay jNz7d6f+JQ+M2qrQu5BSDBjyvQrBWozAbq3IGC7htLrere52E6TPaqvNGWqjrKf9Y8se LFFiMboOhh/devTuYCWkB6VF9wdEGrUWLAHoUwc8SYymkXEqMCkPa9HQ8BFSGMMBr4pj GHlJ10F9YN5YoxWQczKpsUDbXywc6zA7ExKWpsK6bHJ8Uph5SZx3JwnO016ENxPWNm9e NDFFLuXtPa0SPGVkj9jnSL/RykzaizfNjpKm5yICcNC8pndn4S7Qk5n7cV7fDQhmvA7q x4tg== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.156.68 with SMTP id v4mr2935665vcw.10.1362078794114; Thu, 28 Feb 2013 11:13:14 -0800 (PST) |
| In-Reply-To | <512f92fa$0$40355$4fafbaef@reader1.news.tin.it> |
| References | <512f92fa$0$40355$4fafbaef@reader1.news.tin.it> |
| Date | Thu, 28 Feb 2013 14:13:14 -0500 |
| Subject | Re: Import web content to csv only if values are different from those of an excel sheet |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| To | io <maroso@libero.it> |
| Content-Type | multipart/alternative; boundary=f46d043892e1adeeb904d6cdae9f |
| Cc | "python-list@python.org" <python-list@python.org> |
| 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.2666.1362078796.2939.python-list@python.org> (permalink) |
| Lines | 142 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362078796 news.xs4all.nl 6908 [2001:888:2000:d::a6]:52031 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40155 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Thu, Feb 28, 2013 at 12:25 PM, io <maroso@libero.it> wrote:
> Hi,
>
> i have the following python script that reads json data from a website
> and writes it in a csv file that i will then import to excel. (i have
> just started since a week with py so i'm a noob!) :
> -------------------------------------------------------
>
> import json
> import urllib
> import csv
>
> url = "http://bitcoincharts.com/t/markets.json"
> response = urllib.urlopen(url);
> data = json.loads(response.read())
>
> f = open("/home/io/markets.csv","wb")
> c = csv.writer(f)
>
> # write headers
> c.writerow(["Currency","Symbol","Bid", "Ask", "Volume"])
>
> for d in data :
> if d["currency"] <> "SLL": #esclude la valuta di secondlife SLL
> if d["bid"] is not None and d["ask"] is not None:
> c.writerow([str(d["currency"]),str(d["symbol"]),str(d
> ["bid"]),str(d["ask"]),str(d["currency_volume"])])
>
> ------------------------------------------------------
>
> I have an .ods file (libre calc - i'm on linux) where i have in a sheet
> called "exclusions" a list of names (symbol) the i want to exclude during
> the import from web.
>
If you could output this file as csv you don't have a difficult problem.
If you can't, I found this:
http://stackoverflow.com/questions/4745024/spreadsheet-to-python-dictionary-conversion
which discusses reading ods files.
>
> I would like to modify my script so that it can parse each row in the
> "exclusion" sheet and if "symbol" = "parsed row value" then don't write
> it to the csv file ... to loop on all values in the "exclusion" sheet.
>
> I know it's certainly possible but i don't know how to do that. (if it
> results easier having the exclusion list in a text file it's not a
> problem, i'm not really stuck with librecalc!)
>
> Thanks in advance to any helpful soul! :-)
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Joel Goldstick
http://joelgoldstick.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Import web content to csv only if values are different from those of an excel sheet io <maroso@libero.it> - 2013-02-28 17:25 +0000 Re: Import web content to csv only if values are different from those of an excel sheet Joel Goldstick <joel.goldstick@gmail.com> - 2013-02-28 14:13 -0500
csiph-web