Advertisement
Redomine

mocha

Jul 2nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. with open(r'C:\Pyton\dataset_3363_2.txt') as inf:
  2. stroka=inf.readline()
  3. chislo=''
  4. for x in range(len(stroka)):
  5. if stroka[x].isdigit():
  6. chislo+=stroka[x]
  7. if x==(len(stroka)-1):
  8. print(bukva*int(chislo), end='')
  9. break
  10. if stroka[(x+1)].isalpha():
  11. print(bukva*int(chislo), end='')
  12. chislo=''
  13. elif x==(len(stroka)-1): print(bukva*int(chislo), end='')
  14. else:
  15. bukva=stroka[x]
  16.  
  17.  
  18.  
  19. stroka='q7B11r11B8g19M11F20h9s4E9Q19S13E18Z19A1h14V17Z17S5p12z12H10v13a13n5h19C6n20V7'
  20. print(len(stroka))
  21. chislo=''
  22. for x in range(len(stroka)):
  23. if stroka[x].isdigit():
  24. chislo+=stroka[x]
  25. if x==(len(stroka)-1):
  26. print(bukva*int(chislo), end='')
  27. break
  28. if stroka[(x+1)].isalpha():
  29. print(bukva*int(chislo), end='')
  30. chislo=''
  31. elif x==(len(stroka)-1): print(bukva*int(chislo), end='')
  32. else:
  33. bukva=stroka[x]
  34.  
  35.  
  36. stroka="20V7" <=== ошибку пишет тут
  37. print(len(stroka))
  38. chislo=''
  39. for x in range(len(stroka)):
  40. if stroka[x].isdigit():
  41. chislo+=stroka[x]
  42. if x==(len(stroka)-1):
  43. print(bukva*int(chislo), end='')
  44. break
  45. if stroka[(x+1)].isalpha():
  46. print(bukva*int(chislo), end='')
  47. chislo=''
  48. elif x==(len(stroka)-1): print(bukva*int(chislo), end='')
  49. else:
  50. bukva=stroka[x]
  51.  
  52. SyntaxError: multiple statements found while compiling a single statement
  53. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement