Get String Index Python Method Chaining Java