Python raw_input不会提示

1 python input

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

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()
Run Code Online (Sandbox Code Playgroud)

小智 5

标准习语在这里很有用:

if __name__ == '__main__':
    main()
Run Code Online (Sandbox Code Playgroud)