Hi all, Let’s keep these “how to” question on stackoverflow, not here in the dev mailing list.
Nick — Dr Nicholas Car Data Systems Architect SURROUND Australia 0477 560 177 [email protected] > On 9 Jun 2020, at 9:10 am, Wes Turner <[email protected]> wrote: > > > FWIW, in Python 3.9, there are new str.removeprefix() and str.removesuffix() > methods; though you'd still be doing two containment tests whereas re.sub > only does only containment test (but does require an 'import re') > https://www.python.org/dev/peps/pep-0616/ > https://docs.python.org/3.9/library/stdtypes.html#str.removeprefix > >> On Mon, Jun 8, 2020, 10:50 AM Boris Pelakh <[email protected]> wrote: >> Easiest way is to strip the namespaces yourself: >> >> import re >> >> for row in qres: >> print(" %s is %s" % tuple(re.sub(r'^.*[/#]', '', r) for r in row)) >> >> If you want to use the namespace manager, you can do this similarly: >> >> for row in qres: >> print(" %s is %s" % tuple(g.qname(r).split(':')[1] for r in row)) >> >> >> >> -- >> http://github.com/RDFLib >> --- >> You received this message because you are subscribed to the Google Groups >> "rdflib-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rdflib-dev/0b0cd799-73d5-40e2-961a-c02ca8ad896eo%40googlegroups.com. > > -- > http://github.com/RDFLib > --- > You received this message because you are subscribed to the Google Groups > "rdflib-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rdflib-dev/CACfEFw83MFLMYJmBWind0CuHPar5YkV0t8aR%3DUUh3m3-xKAk8A%40mail.gmail.com. -- http://github.com/RDFLib --- You received this message because you are subscribed to the Google Groups "rdflib-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rdflib-dev/AABA8961-633E-4ED1-8BAD-1EA00BB924D5%40surroundaustralia.com.
