为什么Python返回'None'

时间:2018-07-20 13:21:02

标签: python list

'''

  function 'text_strip_split(text)' delete special symbolsand
  whitespace in start and end string,after we enter number of word ,
  that it should write , and finally write this word.

'''

def text_strip_split(text):

    list = [ '!' , ',' , '.' , '?' , ':' , '/' , '*' , '#' , '%' , '\\' , '_' , '-' , '=' , '+' , '&' ,';']

    for i in list:
        text = text.replace( i  , ' ').strip()
    text = text.split()

    print()

    while True:
        x = int(input('Enter number word that i should print on console:\n')) - 1
        if x > len(list) or x < 0:
            print('Enter other number!')
        else:
            break

    print(text[x])


word = input('Write the something text with special symbols: \n')
print(text_strip_split(word))

1 个答案:

答案 0 :(得分:1)

该函数中没有return语句。