gpt4 book ai didi

Python raw_input 不会提示

转载 作者:太空宇宙 更新时间:2023-11-04 07:30:32 25 4
gpt4 key购买 nike

当我运行程序时输入不会提示。我该如何解决?

import sys
def main():

# Initialize list and determine length
string_list = raw_input("Enter your strings to be sorted: ").split(' ')
string_list.sort()
length = len(string_list)

# If there are more than one strings to sort, print the list
# Otherwise break
if length > 1:
print(string_list)
elif length < 0:
print("Enter more than one string to sort")
return sys.exit()

最佳答案

标准习语在这里很有用:

if __name__ == '__main__':
main()

关于Python raw_input 不会提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48832559/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com