在Python中拆分列表并分离每个元素

时间:2019-01-30 12:41:31

标签: python list

我想将列表的每个元素拆分为新列表,然后将内部列表中的每个单词拆分为单独的元素。感谢您的帮助!

listaTest = ['Anna,Annowska,450', 'Bartosz,Bartecki,500']

listaTestNew = [['Anna','Annowska','450'],['Bartosz','Bartecki','500']]

2 个答案:

答案 0 :(得分:0)

<div class="w3-content w3-display-container">
  <img class="mySlides1" src="images01/designed1.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed2.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed3.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed4.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed5.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed6.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed7.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed8.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed9.jpg" style="width:50%">
  <img class="mySlides1" src="images01/designed10.jpg" style="width:50%">
  <button class="w3-button w3-black w3-display-left" onclick="plusDivs(-1, 0)">&#10094;</button>
  <button class="w3-button w3-black w3-display-right" onclick="plusDivs(1, 0)">&#10095;</button>
</div>

此打印:

listaTest = ['Anna,Annowska,450', 'Bartosz,Bartecki,500']
print(list(map(lambda x: x.split(','), listaTest)))

答案 1 :(得分:0)

尝试一下

<ContentPage.Resources>
    <ResourceDictionary>
        <converter:UrlConverter x:Key="UrlConverter" />
    </ResourceDictionary>
</ContentPage.Resources>

 <Image Source="{Binding YourProperty, Converter={StaticResource UrlConverter}}"/>

希望有帮助