Python Forum

Full Version: Ideas for creating a function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I would like to make a program where a user can copy and paste various items from a game which would include amounts of these items into my program and then the program would take this copy and paste and do some stuff with it. ive explained below

Get users copy and paste
Find key words in the string that user inputs along with the amount that is given.
Assign keywords and amounts to separate variables
Match keywords with rows in a csv file with same name and return the values associated with them.
Im not looking for code per-say, im just looking for pointers on how i could get this problem solved. I thought about using slices of the copy and paste but this wouldnt work as the copy and paste wont always be the same so im unable to predetermine the indexs that i would need to slice. so it would need to be some kind of search function which can then assign each word to different variables that can then be cross checked against a csv file to pull the data i need.

If someone could point me in the right direction, that would be great.

Thanks in advance