0

I use tesseract to transform the text in image to plain text and I do that using pyautogui.typewrite because print doesn't really work for my case.

The plain text is formatted like this: "F I J D S"

Is it possible to ignore the space key and shift key, so that the output is "fijds"?

CrawL
  • 11
  • 1
  • 4
  • what do you mean by ignore? like this? `"".join([i for i in x if i != ""])` – LercDsgn Nov 23 '22 at 22:10
  • I'm trying to create a bot for a fishing game, while fishing there appears random keys on the screen that you need to press in order to fish, [example](https://imgur.com/a/gLB2Hkx) . I'm using **pyautogui.typewrite** to press the keys that appear on the screen but since there is some space between the characters and all of them are capital letters, pyautogui presses **shift** and **space** between every key but I don't want it to press shift and space. I hope you understood. – CrawL Nov 24 '22 at 13:44
  • This is my [code](https://pastebin.com/z7EwSfWX) if you want to take a look at it. – CrawL Nov 24 '22 at 14:04
  • Well I fixed the shift problem by doing `pyautogui.typewrite(tesstr.lower(), interval=0.25)` but I don't know how to ignore the space key. – CrawL Nov 24 '22 at 14:36
  • https://stackoverflow.com/questions/8270092/remove-all-whitespace-in-a-string – mkrieger1 Nov 24 '22 at 15:19
  • This thread fixed my problem thanks to @mkrieger1 https://stackoverflow.com/questions/8270092/remove-all-whitespace-in-a-string – CrawL Nov 25 '22 at 22:36

0 Answers0