Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > pl.comp.lang.python > #152
| X-Received | by 2002:ae9:f205:: with SMTP id m5mr1616881qkg.152.1576663649043; Wed, 18 Dec 2019 02:07:29 -0800 (PST) |
|---|---|
| X-Received | by 2002:aed:2906:: with SMTP id s6mr1380130qtd.12.1576663648811; Wed, 18 Dec 2019 02:07:28 -0800 (PST) |
| Path | csiph.com!xmission!news.alt.net!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!g89no2981174qtd.0!news-out.google.com!w29ni1897qtc.0!nntp.google.com!g89no2981168qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail |
| Newsgroups | pl.comp.lang.python |
| Date | Wed, 18 Dec 2019 02:07:28 -0800 (PST) |
| In-Reply-To | <5df7b2b9$0$503$65785112@news.neostrada.pl> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | google-groups.googlegroups.com; posting-host=185.80.118.59; posting-account=Fo7zdgoAAABGKssuFnERA3oNSS91bR7E |
| NNTP-Posting-Host | 185.80.118.59 |
| References | <5df7b2b9$0$503$65785112@news.neostrada.pl> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <f2b06697-c712-4ebe-a2c4-a9b7bfab249e@googlegroups.com> (permalink) |
| Subject | Re: Unicode |
| From | damian@swistowski.org |
| Injection-Date | Wed, 18 Dec 2019 10:07:29 +0000 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | quoted-printable |
| Lines | 45 |
| Xref | csiph.com pl.comp.lang.python:152 |
Show key headers only | View raw
W dniu poniedziałek, 16 grudnia 2019 16:37:14 UTC użytkownik Cezary Grądys napisał:
> Witam.
> Sorry za lamerstwo, ale mam w pliku (json) linie typu:
>
> "sender_name": "Cezary Gr\u00c4\u0085dys",
>
> Chcę z tego zrobić
>
> "sender_name": "Cezary Grądys",
>
>
> Szkielet skryptu taki:
>
>
> #!/usr/bin/python3
>
> import sys
> import re
>
> try:
> f = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin
> except FileNotFoundError:
> print("Brak pliku")
> exit(1)
> except PermissionError:
> print("Brak dostępu do pliku")
> exit(1)
>
>
>
> for line in f:
> line = line.strip()
>
> # co tu wstawić ????
>
> print(line)
>
>
>
- print(p['content']) # w tej linii błąd, chociaż kilka wypisuje.
+ print(p.get('content', '')) # w tej linii błąd, chociaż kilka wypisuje.
Back to pl.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Unicode Cezary Grądys <czarekgr@wa.onet.pl> - 2019-12-16 17:37 +0100
Re: Unicode zzz <zzz@lipa.localhost.invalid> - 2019-12-17 01:15 +0000
Re: Unicode Cezary Grądys <czarekgr@wa.onet.pl> - 2019-12-17 19:57 +0100
Re: Unicode damian@swistowski.org - 2019-12-18 02:07 -0800
Re: Unicode Cezary Grądys <czarekgr@wa.onet.pl> - 2019-12-19 13:16 +0100
csiph-web