0

Python Question

How can I skip some information in Python? Please give me function and code!!! Input: (“x=1, y=1, RGB=255, 255, 255”) <—string Output: (“RGB=255, 255, 255”) <—string Input and Output are string!!! Hope you can solve me problem. Thank you very much for your help.

11th Jan 2020, 2:00 AM
Ethan
Ethan - avatar
1 Antwort
0
Looking at your input, I believe you can use slicing. This basically gets a substring from a string. If your input looks like this: x=1, y=1, RGB=255, 255, 255 You would type in: input[10:] This basically gets the string starting from index nine, which happens to be "R". Another option is split(), which splits your string into a list based on a character, but it won't work, because commas are separating the RGB values.
11th Jan 2020, 2:19 AM
Jianmin Chen
Jianmin Chen - avatar