Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は文字列を持っていますstr="[0,1,12]"
str="[0,1,12]"
"["、"]"、および","のみを取り除き、数字をlist後ろに残す最も効率的な方法は何ですか? を試し.rstrip()てみましたが、文字列の末尾の文字しか取得できません。
"["
"]"
","
list
.rstrip()
文字列を次のように評価しますlist。
from ast import literal_eval numbers = literal_eval(your_string)