Hi Andreas, that's exactly what I need.
In : s.split('.', 1) Out: ['host', 'sub1.sub2.example.com <http://sub2.example.com>'] Thanks. Am Sonntag, 27. Oktober 2019 18:25:04 UTC+1 schrieb Andreas Härpfer: > > Hi Matti, > > I'm not exactly sure what you are trying to accomplish, but I would > like to point out that `split()` has an optional parameter `maxsplit` > that limits the number of splits that are actually done. Shouldn't > that help to solve your problem? > > In : s='host.sub1.sub2.example.com' > > > In : s.split('.', 2) > > Out: ['host', 'sub1', 'sub2.example.com'] > > In : s.split('.', 3) > > Out: ['host', 'sub1', 'sub2', 'example.com'] > > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/36e42528-ac90-40c1-a440-51d637e5cde2%40googlegroups.com.