On 30. 04. 20 8:50, Miro Hrončok wrote:
On 30. 04. 20 1:21, Adam Williamson wrote:
I have this in my PATH (called pkgname):
#!/usr/bin/python3
import fileinput
for line in fileinput.input():
print('-'.join(line.split('-')[:-2]))
how about:
print(line.rsplit("-", 2)[0])
That's indeed probably nicer.
And a bit faster.
New:
$ wc -l tmplst; time cat tmplst | pkgname > /dev/null
11372184 tmplst
real 0m8,924s
user 0m8,759s
sys 0m0,489s
Old:
$ wc -l tmplst; time cat tmplst | pkgname > /dev/null
11372184 tmplst
real 0m10,425s
user 0m10,200s
sys 0m0,584s
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx