Python Forum

Full Version: How to split the input taken from user into a single character?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there everyone,
Hope you guys are doing awesome coding! I'm new and learning python. I just wanted to ask you guys that I want to take the input from user which can be done by using input() function, Now I want to split all the characters typed in by the user into single character. I can use split() function for the purpose but that wouldn't do the job I wanted.
How should I do it? Kindly explain the step for assistance.
Thanks in advance! God Bless you all.
Is this what you after?

string = input()
string = list(string)
print(string)
(Aug-17-2022, 10:10 AM)menator01 Wrote: [ -> ]Is this what you after?

string = input()
string = list(string)
print(string)

Thanks for replying menator01.
For my own use, I sometimes need to .split() input to get the top left and bottom right of a rectangle.
I keep doing this in a while loop, until I am happy with the result jpg.

I do:

nums = input('Enter the coordinates you want, separated by a space ... ')
Then I enter something like:

50 300 1500 2000

coords = nums.split()
which gives me a list of 4 numbers [50, 300, 1500, 2000} I can pass to Image to crop the picture.