【问题标题】:I'm working with text files and I need this:我正在处理文本文件,我需要这个:
【发布时间】:2022-01-13 17:31:15
【问题描述】:

我有这样的字符串列表:

list1=[354 26 23.02.2013 01:31:24]

list1[0]=3

我需要:

list1[0]=354

【问题讨论】:

    标签: python python-3.x list text split


    【解决方案1】:

    我假设您正在尝试在空格处拆分字符串。请尝试以下操作:

    splitted_list='354 26 23.02.2013 01:31:24'.split(' ')
    print(splitted_list[0]) //Outputs 354
    

    【讨论】:

    • 谢谢这是我需要的
    猜你喜欢
    • 1970-01-01
    • 2020-03-16
    • 1970-01-01
    • 2022-11-20
    • 1970-01-01
    • 2018-02-20
    • 2014-04-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多