Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104658
| Path | csiph.com!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Fillmore <fillmore_remove@hotmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Perl to Python again |
| Date | Fri, 11 Mar 2016 18:42:24 -0500 |
| Organization | Aioe.org NNTP Server |
| Lines | 21 |
| Message-ID | <nbvl51$9ch$1@gioia.aioe.org> (permalink) |
| NNTP-Posting-Host | SxA1UDOcaYBihz5zYbn9yQ.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Mozilla-News-Host | news://nntp.aioe.org:119 |
| Xref | csiph.com comp.lang.python:104658 |
Show key headers only | View raw
So, now I need to split a string in a way that the first element goes
into a string and the others in a list:
while($line = <STDIN>) {
my ($s,@values) = split /\t/,$line;
I am trying with:
for line in sys.stdin:
s,values = line.strip().split("\t")
print(s)
but no luck:
ValueError: too many values to unpack (expected 2)
What's the elegant python way to achieve this?
Thanks
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Perl to Python again Fillmore <fillmore_remove@hotmail.com> - 2016-03-11 18:42 -0500
Re: Perl to Python again sohcahtoa82@gmail.com - 2016-03-11 16:04 -0800
Re: Perl to Python again Fillmore <fillmore_remove@hotmail.com> - 2016-03-11 19:15 -0500
Re: Perl to Python again alister <alister.ware@ntlworld.com> - 2016-03-12 09:40 +0000
Re: Perl to Python again Fillmore <fillmore_remove@hotmail.com> - 2016-03-12 08:10 -0500
csiph-web