我的Python图形用户界面不断显示一个整数是元组

2024-10-03 21:24:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我的代码如下:

# Hello World program in Python

def timesummer(str1):
     str2="."
     location=str1.find(str2,)
     location=location-1
     location1=int(location)
     strmin=str1[0,location]
     float1=float(strmin)
     minutes=int(float1)
     location=location+1
     strsec=str1[location,len(str1)-1]
     float2=float(strsec)
     seconds=int(seconds)
     finalanswer=seconds+(minutes*60)
     return finalanswer

print timesummer("1.10")

当我运行它时,它在strmin=str1[0,位置] 无效,因为我使用的是元组值? 如何修复代码? 我使用的是元组值吗?你知道吗


Tags: 代码hellolocationfloatint元组secondsminutes