پاسخ : برخی از مشکلات من در دستورات پایتون

ساخت وبلاگ

سلام
من یه مشکلی تو اجرای دستورات پاتون دارم بینید مشکل از کجاست
این دستورو که اجرا می کنم اینو میگه
while True:
   s = raw_input ('enter something: ')
   if s == 'quit':
      break
   if len (s) < 3:
         continue
   print ('input is of sufficent lentgth')
   # do other kinds of processing here...
اجرای دستور داخل کاماند پارت
Traceback (most recent call last):
  File "C:Documents and SettingsamirDesktopNew Foldercontinue.py", line 2,
in <module>
    s = raw_input ('enter something: ')
NameError: name 'raw_input' is not defined
و دومین دستور
while True:
   s = raw_input ('Enter something : ')
   if s == 'quit':
      break
      print ('Length of the string is'), len(s)
print ('Done')
اجرای دستور
Traceback (most recent call last):
  File "C:Documents and SettingsamirDesktopNew Folderbreak.py", line 2, in
<module>
    s = raw_input ('Enter something : ')
NameError: name 'raw_input' is not defined
مشکل از کجاست لطفا راهنمایم کنید
در اصل پیغامی که باید دستودر اول میداد
python continue.py
enter something : a
enter something : 12
enter something : abc
input is of sufficent length
enter something : quit
و پیغامی که دستور دوم باید میداد
python break.py
Enter something : Programming is fun
Length of the string is 18
Enter something : When the work is done
Length of the string is 21
Enter something : if you wanna make your work also fun:
Length of the string is 37
Enter something : use Python!
Length of the string is 12
Enter something : quit
Done
کمک کنید لطفا

اوبونتو...
ما را در سایت اوبونتو دنبال می کنید

برچسب : نویسنده : استخدام کار ubuntu بازدید : 229 تاريخ : دوشنبه 1 شهريور 1395 ساعت: 13:04