Python
- 128 ответов
- 0 вопросов
69
Вклад в тег
>>> class Person:
... first_name = 'First'
... last_name = 'Last'
...
... @property
... def full_name_1(self):
... return ' '.join([self.first_name, self.last_name])
...
... def full_name_2(self):
... return ' '.join([self.first_name, self.last_name])
...
>>> p = Person()
>>> p.full_name_1
'First Last'
>>> p.full_name_2()
'First Last'
>>> p.full_name_2
<bound method Person.full_name_2 of <__main__.Person object at 0xb739a5ec>>
>>>
[guest@localhost t]$ ls
[guest@localhost t]$ touch cat
[guest@localhost t]$ echo hello >file.txt
[guest@localhost t]$ ll
итого 4
-rw-rw-r--. 1 guest guest 0 дек 30 11:32 cat
-rw-rw-r--. 1 guest guest 6 дек 30 11:32 file.txt
[guest@localhost t]$ *
hello
[guest@localhost t]$
[guest@localhost tmp]$ cat "file.html" | sed 's/"http/\n&/g' | sed -n 's/^"\(http[^"]*\)".*/\1/p'
http://tasteofcountry.com
https://s3.amazonaws.com/tsm-images/logos/footer/204-light.png?id=78
http://tasteofcountry.com/shocking-country-music-splits/
http://tasteofcountry.com/reba-mcentire-narvel-blackstock-relationship-timeline/
http://screencrush.com/official-batman-vs-superman-plot-synopsis/?footer
http://wac.450f.edgecastcdn.net/80450F/screencrush.com/files/2015/07/batman-vs-superman-300.jpg?w=180&h=120&zc=1&s=0&a=t&q=89
http://popcrush.com/stars-who-were-born-rich/?footer
http://wac.450f.edgecastcdn.net/80450F/popcrush.com/files/2015/04/born-rich-300.jpg?w=180&h=120&zc=1&s=0&a=t&q=89
http://diffuser.fm/offensive-band-names/?footer
http://wac.450f.edgecastcdn.net/80450F/diffuser.fm/files/2015/03/offensive-band-names.jpg?w=180&h=120&zc=1&s=0&a=t&q=89
http://comicsalliance.com/comic-book-movie-behind-the-scenes-pictures/?footer
http://wac.450f.edgecastcdn.net/80450F/comicsalliance.com/files/2015/05/behind-the-scenes-300.jpg?w=180&h=120&zc=1&s=0&a=t&q=89
http://tasteofcountry.com/you-think-you-know-country-taylor-swift/?footer
http://wac.450f.edgecastcdn.net/80450F/tasteofcountry.com/files/2014/08/taylor-swift-sexy.jpg?w=180&h=120&zc=1&s=0&a=t&q=89
[guest@localhost tmp]$
Если сейчас все так просто, то нужно разбираться в make/cmake?
# Build section
CC = gcc
CFLAGS = -ansi -pedantic -Wall
TARGET = ntow
OBJS = main.o noun.o triple.o number.o cmdline.o errors.o input.o
BASEDIR = .
TESTDIR = $(BASEDIR)/tests
# Install section
prefix = /usr/local
PREFIX = $(prefix)
BINDIR = $(PREFIX)/bin
# Rules
all: $(TARGET)
$(TARGET): $(OBJS)
@$(CC) $(CFLAGS) $^ -o $@ && echo "$(TARGET) has built"
main.o: cmdline.h number.h input.h errors.h
triple.o: triple.h
number.o: number.h
cmdline.o: cmdline.h errors.h
# Commands
help:
@echo "usage: make [ test | install | uninstall | clean | cleanall ]" 1>&2
test: $(TARGET)
@$(MAKE) -C $(TESTDIR) run
clean:
@rm -f $(OBJS) $(TARGET) && echo "$(TARGET) cleaned"
cleanall: clean
@$(MAKE) -C $(TESTDIR) clean
install:
install -d $(BINDIR)
install $(TARGET) $(BINDIR)/$(TARGET)
uninstall:
rm -f $(BINDIR)/$(TARGET)
.PHONY: help all test clean cleanall install uninstall