# ansible and pyhton

**URL:** <https://forum.ansible.com/t/ansible-and-pyhton/20053>\
**Category:** Ansible Project\
**Created:** [December 21, 2015, 12:18pm UTC](https://forum.ansible.com/t/ansible-and-pyhton/20053 "2015-12-21T12:18:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_salvado](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Anthony\_salvado](https://forum.ansible.com/u/Anthony_salvado)\
**Post date:** [December 21, 2015, 12:18pm UTC](https://forum.ansible.com/t/ansible-and-pyhton/20053/1 "2015-12-21T12:18:49Z")

</div>

hi all,

i want use this on ansible variable :

**import re**  
**number1 = re.findall(“\d+”, ansible\_hostname)**

**i’ve try this :**

**number1: "{{ re.findall** \*\*(‘\d+’, ansible\_hostname) }}"\*\*

**but it’s not ok ^^**

**have you idea ?**

---

<div class="post-metadata">

**Author:** ![Anthony\_salvado](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Anthony\_salvado](https://forum.ansible.com/u/Anthony_salvado)\
**Post date:** [December 21, 2015, 12:21pm UTC](https://forum.ansible.com/t/ansible-and-pyhton/20053/2 "2015-12-21T12:21:20Z")

</div>

i want find the number on the variable ansible\_hostname :

for instance :  
dev1-client → i want 1  
dev2-client → i want 2  
prod12-client → i want 12
