oycc2000
tup=("")
string=""
list1=[]
for i in range(100,1000):
A=str(i)[0]
B=str(i)[1]
C=str(i)[2]
if int(A)**3+int(B)**3+int(C)**3==i:
list1.append(str(i))#字符串转换成列表,并添加新的元素
print(",".join(list1))#列表重新转换成字符串,并打印


学习内容:

1.字符串转列表

2.列表转字符串

 

1. 字符串转列表

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

 

2. 列表转字符串

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

分类:

技术点:

相关文章:

  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案