使用python2.7.18运行代码后,我将遇到以下错误。
File "<string>", line 1, in <module>
NameError: name 'pynative' is not defined
代码:
import string
def removechars(stri1,num):
if num < len(stri1):
new_string = stri1[num:]
print(new_string)
else:
print('Cannot remove characters from the string')
string1 = input('Enter a string ')
print('the entered string is ',string1)
num1 = int(input('Enter the number of characters you want to remove from earlier string'))
print('The new string is ')
removechars(string1,num1)