using list comprehension,
magicInput = [_ for _ in input("Enter String:")]
print('magicList = [{}]'.format(', '.join(magicInput)))
produces
Enter String:python rocks
magicList = [p, y, t, h, o, n, , r, o, c, k, s]
You can use str.join()
to concatenate strings with a specified separator.
Furthermore, in your case, str.format()
may also help.
However the apostrophes will not interfere with anything you do with the list. The apostrophes show that the elements are strings.
Method 2:
magicInput = ','.join(input('Enter String: '))
print(f'\nmagicList: [{magicInput}]')
Edit 1:
user_input = input("Enter String:")
magic_list = list(user_input)
print(f'magic_list = {magic_list}')
This code captures the user input as a string and then converts it into a list of characters using list().