Not panda but python- getting last few words in a string

After messing with some network code (I knew it would happen anyways) that tcp will wait for all blocks and then send all data at once. I know how to get it if its a known size just not sure how to go about it if its unkown.

  1. So really I just need a way to get the last 4 words out of the unkown size of text, but not sure how to go about that?

I don’t quite understand the question, but wouldn’t something like this work:

last4words = text.strip().split(" ")[-4:]

Thanks, yea thats what I was perty much asking for.

TCP waits for any missing data and then ask for it while stack up all the incoming calls till it gets the missing one, so I end up with a few lines of data from the movement code sending the

kk, just going to re-use this again so I dont make to many wasted post lol.

Anyways I got the Network code to work but it seems really slugish, so i’m hoping some one can look at the code, you can also play to see what I mean, it’ll only work for a day of post due to my ip always changing around.



wasd are the moving around keys
mouse lets you point where you’r going
the “+” makes it full screen or back to little
then esc is exit.

I’ll be either in the starting area or around the water. If i’m not there i’ll be there in a min, so far i’ve had 4 people try it (in the last 20mins of post this), so if not me, someone else will be.