ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Gleb Kulikov <glebus@asd.iao.ru>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] Как удалить пробелы
Date: Tue, 2 Sep 2008 09:46:48 +0700
Message-ID: <200809020946.48695.glebus@asd.iao.ru> (raw)
In-Reply-To: <48BC2B07.3070409@rambler.ru>

In message [Вторник 02 сентября 2008] from Kharitonov A. Dmitry was written:

> > my $str="   123   123  ";
> > print "$str\n"; # получаем "   123   123  "
> > $str =~ s/^( )*//ig;
> > print "$str\n";  #  получаем "123   123  "
>
> я чего-то никакой разницы с bashем не увидел. А если учесть, что читать

1. питон:

t = "  123 123     "
t.strip()
t.lstrip()
t.rstrip()
ну и регекспы, если хочется.

2. не видел ни одного дистрибутива. в котором питон не был бы установлен по 
умолчанию, разве что в паталогически минималистичных.

> А теперь представьте, что этот скрипт нужно встроить в модем, и туда ещё
> перл из-за этого грузить придётся.

3. для встроенных систем с катастрофически ограниченными ресурсами, и баша 
может быть много. вряд ли надо заранее во всех случаях устраивать себе 
геморрой на маловероятный случай утаптывания скрипта в минисистему.

> строчки нужно из файла, то sed однозначно рулит.

4. 
for line in file:
    line = line.strip().split()
    for element in line:
        # --- прочий парсинг

-- 
      Салют, /GLeb

UIN: 15341920
jabber://gleb@asd.iao.ru
sip://2387245@sipnet.ru			(telephony)
skype://gleb_kulikov.tomsk		(telephony)
sip://20000204@sip.pctel.ru		(telephony)
netmail: 2:5005/78

  reply	other threads:[~2008-09-02  2:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-31 14:17 Kharitonov A. Dmitry
2008-08-31 14:25 ` Michael Holzman
2008-08-31 16:00   ` Yura Kalinichenko
2008-08-31 16:32     ` Kharitonov A. Dmitry
2008-09-01 13:19     ` Yury Aliaev
2008-08-31 16:33   ` Kharitonov A. Dmitry
2008-09-01 14:15     ` Slava Dubrovskiy
2008-08-31 18:21 ` Yuri Bushmelev
2008-09-01 20:10   ` Michael Shigorin
2008-09-01  3:27 ` Gleb Kulikov
2008-09-01  3:53   ` Kharitonov A. Dmitry
2008-09-01  4:01     ` Denis Nazarov
2008-09-01 17:48       ` Kharitonov A. Dmitry
2008-09-02  2:46         ` Gleb Kulikov [this message]
2008-09-01  4:40     ` Gleb Kulikov
2008-09-01  4:52       ` Denis Nazarov
2008-09-01  4:56         ` Andrey Rahmatullin
2008-09-01 11:27       ` Yuri Bushmelev
2008-09-01 11:40         ` Mikhail Gusarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809020946.48695.glebus@asd.iao.ru \
    --to=glebus@asd.iao.ru \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git