# Python/Maya: Select vertices in a mesh

**URL:** https://forum.highend3d.com/t/python-maya-select-vertices-in-a-mesh/159349
**Category:** Maya
**Tags:** python
**Created:** [April 11, 2019, 1:40pm UTC](https://forum.highend3d.com/t/python-maya-select-vertices-in-a-mesh/159349 "2019-04-11T13:40:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tristang](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/t/d26b3c/32.png) [@tristang](https://forum.highend3d.com/u/tristang)
#### Post date: [April 11, 2019, 1:40pm UTC](https://forum.highend3d.com/t/python-maya-select-vertices-in-a-mesh/159349/1 "2019-04-11T13:40:32Z")

</div>

Hi everyone,

I can’t properly store all my vertices into a list. I want every vertex to be a separate object in my list but Maya  
optimizes that list for some reason and I don’t want that.

allComponents = cmds.ls( sl=True )  
print(allComponents)

Response:  
[u’pCube1.vtx[0:7]']

 ![](https://forum.highend3d.com/uploads/default/original/3X/0/3/03e021aeabb74d53eb98cbdab2e8f077479f44ce.png)

---

<div class="post-metadata">

### Author: ![tristang](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/t/d26b3c/32.png) [@tristang](https://forum.highend3d.com/u/tristang)
#### Post date: [April 11, 2019, 2:15pm UTC](https://forum.highend3d.com/t/python-maya-select-vertices-in-a-mesh/159349/2 "2019-04-11T14:15:29Z")

</div>

After some research I found the fl flag inside the ls command that you have to set to true.  
fl: Flattens the returned list of objects so that each component is identified individually.

I’m sorry 🙂

---

<div class="post-metadata">

### Author: ![system](https://forum.highend3d.com/user_avatar/forum.highend3d.com/system/32/59311_2.png) [@system](https://forum.highend3d.com/u/system)
#### Post date: [August 9, 2019, 6:38pm UTC](https://forum.highend3d.com/t/python-maya-select-vertices-in-a-mesh/159349/3 "2019-08-09T18:38:05Z")

</div>

This topic was automatically closed after 120 days. New replies are no longer allowed.
