2012-04-24 9 views
-2

タプルに変更する必要があるリストに「hello world」という文字列があります。 誰かが私に助けてくれることを望んでいます。 。Python 2.5の文字列、変更されたリストを変更されたタプルに

s1=str("hello world") 
L1= list(s1) 

print type (L1) 
list 

print L1(5) 
+2

-1;。*非常に*基本的な質問、あなたは標準のチュートリアルを行ってきた場合は簡単に答えた、あなたのほかに。質問は明確ではない;あなたは '( 'h '、' '、' '、' '、' '、' '、' '、' '、' '、'世界 ') '? –

答えて

2
s1="hello world" 
L1=s1.split(" ") 
t1=tuple(L1) 
print type(t1) 
tuple 


print(t1) 
('hello', 'world') 
0

私はまた、別の方法を見つけたと思う

s1= str("hello world") 

L1= list(s1) 

print type (L1) 

print L1 
関連する問題