Conversion (three-digit daffodils) Python string list and a list of strings

= TUP ( "") 
String = ""
List1 = []
for I in Range (100,1000):
A = STR (I) [0]
B = STR (I) [. 1]
C = STR (I) [2 ]
IF int (a) ** + int. 3 (B) + int **. 3 (C) == I **. 3:
list1.append (STR (I)) # string into a list and add a new element
print ( ",". join ( list1)) # list back into a string, and prints


Python string conversion list

 

Learning Content:

1. String transfer list

2. List to String

 

1. String transfer list

str1 = "hi hello world"
print(str1.split(" "))
输出:
['hi', 'hello', 'world']

 

2. List to String

l = ["hi","hello","world"]
print(" ".join(l))
输出:
hi hello world

Learning Content:

1. String transfer list

2. List to String

 

1. String transfer list

str1 = "hi hello world"
print(str1.split(" "))
输出:
['hi', 'hello', 'world']

 

2. List to String

l = ["hi","hello","world"]
print(" ".join(l))
输出:
hi hello world

Guess you like

Origin www.cnblogs.com/oycc2000/p/11236687.html