python basic data types and their functions -3- listing

1, enclosed in square brackets is the list of contents

Table of contents can be a number, string, Boolean value, or even list

Elements can be modified

You can modify (delete) elements in the list by index, slicing the way,

Can be carried out for, while loop, support in operation

2, string conversion list list () for cycloconverter according to (digital loop is not possible for it can not be converted to a list)

String transfer list (digital elements, a character string)

Alex = [123,456,"abc"]

s = ""

for test in alex:

s = s+str(test)

print(s)

 

List to String (String element only)

alex = ["abc","def"]

test = "".join(alex)

print(test)

 

Guess you like

Origin www.cnblogs.com/chouchouzhu/p/11122711.html
Recommended