Advertisement
Guest User

Untitled

a guest
Aug 24th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. Traceback (most recent call last):
  2. File "words.py", line 10, in <module>
  3. t = re.sub("'","",word)
  4. File "/usr/lib/python3.6/re.py", line 191, in sub
  5. return _compile(pattern, flags).sub(repl, string, count)
  6. TypeError: cannot use a string pattern on a bytes-like object
  7.  
  8.  
  9. #code
  10.  
  11. import requests
  12. import re
  13. word_site = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-ty$
  14.  
  15. response = requests.get(word_site)
  16. WORDS = response.content.splitlines()
  17. for word in WORDS:
  18. # print(word)
  19.  
  20. t = re.sub("'","",word)
  21. print(t)
  22.  
  23.  
  24. :::
  25.  
  26. before tried:
  27.  
  28. import requests
  29. import re
  30. word_site = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-ty$
  31.  
  32. response = requests.get(word_site)
  33. WORDS = response.content.splitlines()
  34. for word in WORDS:
  35. print(word)
  36.  
  37. >>>> output
  38. ::: # I want to strip off the beginning b and the single quotes.
  39.  
  40. b'zigging'
  41. b'zigzag'
  42. b'zigzagging'
  43. b'zilch'
  44. b'zillion'
  45. b'Zimmerman'
  46. b'zinc'
  47. b'zing'
  48. b'zinnia'
  49. b'Zion'
  50. b'zip'
  51. b'zircon'
  52. b'zirconium'
  53. b'zither'
  54. b'zloty'
  55. b'zodiac'
  56. b'zodiacal'
  57. b'Zoe'
  58. b'Zomba'
  59. b'zombie'
  60. b'zone'
  61. b'zoo'
  62. b'zoology'
  63. b'zoom'
  64. b'zooplankton'
  65. b'Zorn'
  66. b'Zoroaster'
  67. b'Zoroastrian'
  68. b'zounds'
  69. b"z's"
  70. b'zucchini'
  71. b'Zulu'
  72. b'Zurich'
  73. b'zygote'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement